Question: How to Insert Line Break in SQL Server String?
Answer: I personally prefer that SQL Server does not deal with string operations, as SQL language is honestly made for relational operations. However, now as we have this question presented in front us, let us let us try to answer it.
In SQL Server, just inserting a line break in SQL queries will show a line break.
There is no way to explain this so I am going to show you an image which describes how it works.
It is clear from the image that in SQL Server we do not have to insert any special character between line string.
However, to simulate this in SQL Server Management Studio, you need to enable your results in the text format (instead of grid format).
Well, with that said there is another alternative way where we can insert CHAR(13) in the line and it will also demonstrate the result.
Here is the screenshot of that particular code and it will be now clear how to insert a line break in SQL Server.
I personally prefer either of this method as needed by my application. There are some situations where I use the first method and there are some situations where I use the second method.
Which one of the above is your favorite method?
Reference: Pinal Dave (https://blog.sqlauthority.com)