Blog Pages

Line break in a SQL Server string

In order to insert a line break in a SQL Server string, use CHAR(13) or CHAR(10):

CHAR(13) - carriage return:
print 'line 1' + CHAR(13) + 'line 2'

CHAR(10) - Line feed:
print 'line 1' + CHAR(10) + 'line 2'

Note: if you select those string to grid, it won't be showen as 2 lines, but the values of CHAR(13)/CHAR(10) will be saved.

No comments:

Post a Comment