Click here to Skip to main content
15,867,288 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to separate two statements in my stored procedure using Char(13)+char(10).But it is not working.My code as below..

DECLARE @ProjectDescription varchar(100);
SELECT @ProjectDescription = Name FROM SubProjectsList;
SET @Description = 'All Company'+ Char(13)+char(10) + @ProjectDescription;

I want my out put as ...(Suppose Project1 is tha value of @ProjectDescription)
'AllCompany
Project1 '

but its always coming like 'AllCompany Project1 '
Posted
Updated 7-Jul-21 22:14pm
Comments
Thanks7872 8-Dec-15 5:16am    
And where are you going to use this value? There is no meaning of 'line break' in terms of DB.

1 solution

C#
You just concatenate the string and insert a CHAR(13) where you want your line break.

Example:

DECLARE @text NVARCHAR(100)
SET @text = 'This is line 1.' + CHAR(13) + 'This is line 2.'
SELECT @text
This prints out the following:

This is line 1.
This is line 2.



http://blog.sqlauthority.com/2007/08/22/sql-server-t-sql-script-to-insert-carriage-return-and-new-line-feed-in-code/[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900