如何在 Sql 查询中获得新的换行或换行?
Pinal Dave explains this well in his blog.
http://blog.sqlauthority.com/2009/07/01/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')
You could do Char(13) and Char(10). Cr and Lf.
Char(13)
Char(10)
Char() works in SQL Server, I don't know about other databases.
Char()
use CHAR(10) for New Line in SQL char(9) for Tab and Char(13) for Carriage Return
CHAR(10)
char(9)
-- Access: SELECT CHR(13) & CHR(10) -- SQL Server: SELECT CHAR(13) + CHAR(10)