How to insert a line break in a SQL Server VARCHAR/NVARCHAR string

Mark Struzinski picture Mark Struzinski · Aug 27, 2008 · Viewed 1.1M times · Source

I didn't see any similar questions asked on this topic, and I had to research this for something I'm working on right now. Thought I would post the answer for it in case anyone else had the same question.

Answer

Sören Kuklau picture Sören Kuklau · Aug 27, 2008

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.'