DECLARE @x XML = '
Medical Record No. : 1000011 | Patient Name : MR. ANANTHA NARAYANAN S | Age : 60 Year(s) | Sex : male |
| Address : SWASTHIK, B21 BEACH 2ND STREET, AGS COLONY, KOTTIVAKKAM, CHENNAI, |
| TAMIL NADU, INDIA - 600 041. |
SELECT t.c.value('.', 'NVARCHAR(MAX)')
FROM @x.nodes('*') t(c)
when i run the above query output i get correctly as follows
Medical Record No. : 1000011 Patient Name : MR. ANANTHA NARAYANAN S Age : 60 Year(s)Sex : male
Address : SWASTHIK, B21 BEACH 2ND STREET, AGS COLONY, KOTTIVAKKAM, CHENNAI,TAMIL NADU, INDIA - 600 041.
But when i execute the below query
DECLARE @x XML = '
Medical Record No. : 1000011 | Patient Name : MR. ANANTHA NARAYANAN S | Age : 60 Year(s) | Sex : male |
| Address : SWASTHIK, B21 BEACH 2ND STREET, AGS COLONY, KOTTIVAKKAM, CHENNAI, |
| TAMIL NADU, INDIA - 600 041. |
SELECT t.c.value('.', 'NVARCHAR(MAX)')
FROM @x.nodes('*') t(c)
Error as follows
XML parsing: line 14, character 49, whitespace expected
My string value is HTML code, it is not XML. how to overcome the above error.
But i want output as follows
Medical Record No. : 1000011 Patient Name : MR. ANANTHA NARAYANAN S Age : 60 Year(s)Sex : male
Address : SWASTHIK, B21 BEACH 2ND STREET, AGS COLONY, KOTTIVAKKAM, CHENNAI,TAMIL NADU, INDIA - 600 041.
opnion-Glass
Laxmidhar SahooPosted Dec 12, 2017, 1:06 AM