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
 General SQL Server Forums
 New to SQL Server Programming
 inserting new line to a string

Author  Topic 

ann06
Posting Yak Master

171 Posts

Posted - 2009-10-28 : 11:45:16
Hi,
i have a string like this
declare @x varchar(500)

@x= 'this is my first line || this is my second line || line 3'

i want to print this as

this is my first line
this is my second line
line 3

how i shall use the replace function ?

thanks,,

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-28 : 11:48:59
select replace(@x,' || ',char(10))
Only to see in result window if it is toggled to display as text.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -