Help with xml to text

  • I want to convert values from a xml column into a text column.

    Example:

    UPDATE tblTest

    set textData = Convert(text,xmlData)

    Any idea how to realize that?

    Thanks.

  • Hi

    You have to convert your XML to NVARCHAR(MAX), then you can insert into a TEXT column:

    UPDATE @t SET MyText = CONVERT(NVARCHAR(MAX), MyXml

    Two things:

    * TEXT data type is marked as deprecated in SSE2k5 and will be removed in future versions (SSE2k8 still supports)

    * XML is Unicode, so you should use NTEXT (better NVARCHAR(MAX)).

    Greets

    Flo

  • Thanks. It works.

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

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