Gossamer Forum
Home : General : Databases and SQL :

Replace paragraph markers in Ntext field?

Quote Reply
Replace paragraph markers in Ntext field?
I have column in a large table that contains paragraphs of material for each record. The material was first entered in Access and later upsized to SQL 2000.

In SQL the column is a 'ntext' data type.

When I spit this back out into HTML of course the paragraph breaks are not preserved.

Any suggestions for some query language, or a procedure, that I could use to search this column for paragraph markers (or whatever the ASCII equivalent is) and replace them with a <P> tag?

...I know, I know, "Go take a damn SQL class!". Someday I'm going to be forced to.
Quote Reply
Re: [ArmyAirForces] Replace paragraph markers in Ntext field? In reply to
Hi Scott

If you're using ASP try this

<%=Replace((Recordset1.Fields.Item("YourField").Value), Chr(13), "<BR>")%>

This will keep the formatting of text and ntext types

Dregs2
Quote Reply
Re: [dregs2] Replace paragraph markers in Ntext field? In reply to
Dregs2,

Thanks much! I ended up using "Chr(13)+Chr(10)" and it worked like a charm.