Reputation: 7979
I have a table with a field ,description nvarchar(200).
I am inserting string with a lot of lines.
When I take quick watch over the string in visual studio, I can see the string splited over mutile lines as i expected.
line1
line2
line3
But when I insert to database using a stored procedure,all "\n\r" beomes just spaces. When I read from the databse there is no "\n\r"
what can i do?
Upvotes: 3
Views: 7505
Reputation: 190907
It should be stored just fine. When you look through SSMS, it removes the newlines for readability in its grid.
Upvotes: 14
Reputation: 23841
From this answer
char(13) is CR. For DOS-/Windows-style CRLF linebreaks, you want char(13)+char(10), like:
'This is line 1.' + CHAR(13)+CHAR(10) + 'This is line 2.'
Upvotes: 2