如何在SQL Server存储过程中添加换行符?

时间:2022-01-05 07:23:31

I'm making a Stored Procedure that basically concatenates a long string with data from many records.

我正在创建一个存储过程,它将一个长字符串与来自许多记录的数据连接在一起。

I want to do:

我想做的事:

set @output = @output + 'aaa' + LINEBREAK

How do I specify that line break?

如何指定换行符?

2 个解决方案

#1


22  

DECLARE @LINEBREAK AS varchar(2)
SET @LINEBREAK = CHAR(13) + CHAR(10)

#2


1  

Try this:

试试这个:

set @output = @output + 'aaa' + char(13)

#1


22  

DECLARE @LINEBREAK AS varchar(2)
SET @LINEBREAK = CHAR(13) + CHAR(10)

#2


1  

Try this:

试试这个:

set @output = @output + 'aaa' + char(13)