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)
 How to replace new line char in the data value

Author  Topic 

venkath
Posting Yak Master

202 Posts

Posted - 2007-03-13 : 12:32:51
Hi all

I have column with the following data

The license keys for
HiPath ComAssistant Automatic Speech Recognition
HiPath ComAssistant Text-to-Speech
HiPath ComAssistant Speech Enabling

I would like to replace every new line character with <br>

the values should be

The license keys for<br>
HiPath ComAssistant Automatic Speech Recognition<br>
HiPath ComAssistant Text-to-Speech<br>
HiPath ComAssistant Speech Enabling<br>
How can i achive this.

Thanks

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-03-13 : 12:37:29
I think a newline is char(13) and char(10) so try something like:
DECLARE @foo VARCHAR(100)
SET @Foo = 'something' + char(13)+ char(10) + 'else'

PRINT @foo

SELECT REPLACE(@foo, char(13)+ char(10), '<br>')


-Ryan
Go to Top of Page
   

- Advertisement -