467,077 Members | 964 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

removing chr(13) and chr(10) from SQL

Hi.

Is there a way to remove carriage returns and line feeds from a field in SQL.

Here is what I have at the moment:

CAST(m.Description AS VARCHAR(8000))AS "Product Description"

(have had to cast as VarChar because of problems with aggregate functions in rest of query).

Problem is that this m.description field has carriage returns and line breaks in it .. how do I remove these inside the SQL statement?

thanks
Dec 21 '06 #1
  • viewed: 52459
Share:
3 Replies
almaz
Expert 100+
I tried something like this:

CAST(replace(m.Description, vlbf, ' ') AS VARCHAR(8000))AS "Product Description",

and tried variations of vlbf such as chr(10) chr(13) or \r\n and none of them worked.

I can't put them in single quotes as SQL will look for the actual occurence in the string rather than what it stands for.

I get the error column vlbf is unknown or chr(10) is an unknown function....
Dec 22 '06 #3
sorted it now..... used this in the end:

REPLACE(CAST(m.Description AS varChar(1000)),char(13) + char(10),' ') AS "Product Description",

Thanks for the help
Dec 22 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Eddie B. | last post: by
6 posts views Thread by C L Humphreys | last post: by
2 posts views Thread by lauren quantrell | last post: by
10 posts views Thread by Dan Nash | last post: by
1 post views Thread by Felix | last post: by
5 posts views Thread by Computer Guru | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.