Is it possible to store non-alphanumeric characters (more specifically line break characters) in a XML data type?
The code below illustrates my problem:
declare @a xml
declare @b nvarchar(max)
set @b = '<Entry Attrib="1'+CHAR(13)+'2" />'
print @b
set @a=convert(xml,@b,1)
set @b=convert(nvarchar, @a,1)
print @b
The output is:
<Entry Attrib="1
2" />
<Entry Attrib="1 2"/>
Is there any way I could keep the line break intact?
My actual problem is to store the value in a table (rather than a local variable), so maybe there's some setting for the corresponding XML column in my table that would do the job?