convert nvarchar() to xml

  • Hello

    I use SET @text= CAST (@text AS xml) to convert @text to xml, but it didn't work and I have " % " instead of " < "

    Could you help me?

  • This is only possible if you set the NVARCHAR value as XML like below.

    declare @a nvarchar(max)

    set @a = N'<root><name> SQL Server 2012</name></root>'

    select cast(@a as xml)

    It will not be meaningful to have XML as '%' as this is not syntactivally correct for having an XML value.

    Rahul

    Website: http://borngeek.in

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

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