SQL Server - Storing linebreaks in XML data type?

It would not be possible. The XML Data type is stored as an XML DOM Tree, not a string.

It would not be possible. The XML Data type is stored as an XML DOM Tree, not a string. You would have to store it as a varchar instead if you want to keep whitespace.

My answer in the XSLT context should apply here: XML parsed entities are often stored in computer files which, for editing convenience, are organized into lines. These lines are typically separated by some combination of the characters carriage-return (#xD) and line-feed (#xA). So this might be what you are looking for: set @b.

I'm using SQL Server 2005 and I'm getting the following output: – jhrecife Oct 6 '09 at 7:38.

White space inside of an XML tag is not considered significant according to the XML specification, and will not be preserved. White space outside of the element will however: declare @a xml declare @b nvarchar(max) set @b = ' fo'+CHAR(13)+'o' print @b set @a=convert(xml,@b,1) set @b=convert(nvarchar(max), @a,1) print @b will output: fo o fo o.

I get the following error for the second "convert": Msg 6354, Level 16, State 10, Line 13 Target string size is too small to represent the XML instance – jhrecife Oct 6 '09 at 7:37 I got that the first time through too. SQL Server stores nvarchar as 2 bytes for each characters entered + 2 bytes. Your script sets the storage of @b to 46 bytes (2*22 characters + 2), while mine sets the storage at 66 bytes (2*32 characters + 2).

It seems the optimizer will keep that initial assignment storage allocation in the query plan, so you'll need to use a different variable name, run mine in a new query window. – Jeremy S Oct 13 '09 at 19:36.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions