Adding line break to string (SQL)

The following example shows how to implement line breaks in SQL Server. Remember windows uses carriage return line feed and unix systems only line feed.

DECLARE @string1 varchar(25)
DECLARE @string2 varchar(25)
DECLARE @string3 varchar(25)

SET @string1 = 'Hello'
SET @string1 = 'World'
SET @string3 = @string1 + CHAR(13)+CHAR(10) + @string2 
-- char(13) is carriage return and cahr(10) is line feed
-- RESULT
-- Hello
-- World

Comments

There were no comments found for this weblog.

Du mußt Dich einloggen um diesen Weblog kommentieren zu können!