In SQL Query, how do you get a new line or line feed?
Asked by KuldipMCA
Pinal In his blog, Dave discusses this in detail.
SQL SERVER – Difference between Line Feed (n) and Carriage Return (r) – T-SQL New Line Char
DECLARE @NewLineChar AS CHAR(2) = CHAR(13) + CHAR(10) PRINT ('SELECT FirstLine AS FL ' + @NewLineChar + 'SELECT SecondLine AS SL')
Answered by Santosh Chandavaram
-- Access: SELECT CHR(13) & CHR(10) -- SQL Server: SELECT CHAR(13) + CHAR(10)
Answered by Eric Falsken
You can use Char(13) and Char(14) (10). Lf and Cr.
I know that Char() works in SQL Server, but I’m not sure about other databases.
Answered by jvanderh
In SQL, CHAR(10) is used for New Line, CHAR(9) is used for Tab, and CHAR(13) is used for Carriage Return.
Answered by Vinit Prajapati
Post is based on https://stackoverflow.com/questions/1085662/new-line-in-sql-query