Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 line breaks

Author  Topic 

Vivaldi
Constraint Violating Yak Guru

298 Posts

Posted - 2003-05-14 : 08:53:03
I have a varchar field I want to return
from a sproc. I add some text to this field
but I would like to add some line breaks to
format the return text. Is there a way to do this
in SQL?

I am guessing its pretty easy, but I am not finding it in BOL.

________________________________________________
Everytime I think I understand women, I leave the tavern and go home to be humbled.

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-14 : 08:57:54
set @myvarchar = 'this is some text' + char(10)

sometimes, you may need char(13) -- carriage return

or if it's HTML, you may prefer

set @myvarchar = 'this is some text <br>'

Sam

Edited by - SamC on 05/14/2003 09:02:22
Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-05-14 : 08:58:01
You can use char(13) which is the character for line breaks. Like this:

declare @str varchar(100)
select @str = 'Hello' + char(13) + 'next row'



Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-14 : 09:01:32
Oops. I can't count.

char(13) -- carriage return. Nuts.

Sam

Go to Top of Page
   

- Advertisement -