tsql for XML format the values as elements

  • I am trying to get the values in a column as XML elements. Is it possible to do this using For XML in sql server?

    declare @XMLTest table( [Name] [nvarchar](50) NOT NULL )

    INSERT @XMLTest ([Name]) VALUES (N'One¬d¦Uº')

    INSERT @XMLTest ([Name]) VALUES (N'Two')

    INSERT @XMLTest([Name]) VALUES (N'Three')

    I would like to get the following on separate rows from the select query.

    This would help me escape the Invalid characters in the values, so they can then be serialized to XML properly.

    <One_x00AC_d_x00A6_U_x00BA_>

    <Two/>

    <Three/>

    Is it possible to get this return from the FOR XML query, so that the invalid characters are properly encoded when the sql server generates the XML

    ?

  • duplicate post. No replies please. Replies to



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply