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)
 Converting an carrage retrun line feed to HTML code

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-12 : 08:33:55
Regina writes "I am doing a data converstion and have notes written in a Text field.

These have <CR> and line feeds that I need to convert to HTML format.

I know I can use the UpdateText function. But how does SQL store the carrage retun and line feeds?

It does not find <CR>

And how should I store the HTML line feeds in the NText field?

Thanks Regina""

Kristen
Test

22859 Posts

Posted - 2006-01-12 : 14:10:21
"how does SQL store the carrage retun and line feeds?"

Either CHAR(13), CHAR(10) or CHAR(13)+CHAR(10)

"And how should I store the HTML line feeds in the NText field?"

Probably

'<br>' + CHAR(13)+CHAR(10)

which will give you a line break in the "rendered" HTML, and also in the source code. However, this is rather a "blunt" approach - you might be breaking LineBreaks stored in the code for other purposes.

You might also be able to just output your HTML with surrounding <PRE>...</PRE> which should preserve the embedded CR/LF without needing to substitute them.

Kristen
Go to Top of Page
   

- Advertisement -