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 insert CRs and Newlines into type text

Author  Topic 

SQLIsTheDevil
Posting Yak Master

177 Posts

Posted - 2009-04-03 : 09:11:24
In Enterprise Manager, I have literally a ton of records that have <br> tags inside and I need to get rid of those. In a related issue, this text field also has invisible characters that I can't see via Enterprise Manager or Query Analyzer. Thes invisible characters, I think, are carriage returns or something to that effect, because the values inside this field may look something like this on the user-end:

The quick brown <br>
fox jumped over the<br>
the lazy
<br>river.

I want to get rid of the <br> tags and also figure out a way to insert LFs, CRs where the <br> tag shows up. How do I do this?

Thank you.

Naigewron
Starting Member

6 Posts

Posted - 2009-04-03 : 09:57:42
Well, different applications will need different "code" to display a carriage return. Where do you want to display your text?

That being said, I believe "char(10) + char(13)" might do the trick in most cases.

As for the actual replacement, something like this might work:

UPDATE tableName
SET textColumn = REPLACE(textColumn, '<br>', char(10) + char(13))
WHERE whatever clause = true
Go to Top of Page

SQLIsTheDevil
Posting Yak Master

177 Posts

Posted - 2009-04-06 : 11:11:17
Well, I'm displaying the text in a textarea (html) field. The <br> tags are showing up as part of the text. This is not the desired result, even though there appears to be hidden CRs and LFs for some of the values, as depicted in the example above. I will follow your post and see what happens.

Thank you.
Go to Top of Page
   

- Advertisement -