Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

XML Special characters Expand / Collapse
Author
Message
Posted Sunday, March 17, 2013 3:44 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 3:31 PM
Points: 115, Visits: 551
DECLARE @t TABLE(a VARCHAR(100))
INSERT @t SELECT 'abc' UNION ALL SELECT 'd<c>f' UNION ALL SELECT 'ghi'

SELECT
CAST(
(SELECT a+',' FROM @t FOR XML PATH('')) AS XML
).query('/.[1]').value('.','nvarchar(200)')

Would like to see abc,d<c>f,ghi as output
Not abc, d & l t ; c & g t ; f,ghi,

Thanks



Post #1431967
Posted Sunday, March 17, 2013 7:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 3:31 PM
Points: 115, Visits: 551
My fault, actually working correctly.

DECLARE @t TABLE(a VARCHAR(100))
INSERT @t SELECT 'abc' UNION ALL SELECT 'd<c>f' UNION ALL SELECT 'ghi' UNION ALL SELECT '<">'

SELECT
CAST(
(SELECT a+',' FROM @t FOR XML PATH('')) AS XML
).query('/.[1]').value('.','nvarchar(200)')



Post #1431980
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse