all groups > sql server new users > january 2005 >
You're in the

sql server new users

group:

How to search and replace paragraph character in query



How to search and replace paragraph character in query Rod Gilchrist
1/25/2005 10:37:01 AM
sql server new users: I need to search on and replace paragraph characters within a query. Does
anyone know how to do this?

I've tried Replace(expression, chr(13), '') but sql doesn't recognize the
char(13). I've also tried it with vbCrLf and chr(10).

Am I missing something?

Thanks.

Re: How to search and replace paragraph character in query Rod Gilchrist
1/25/2005 11:54:16 AM
Yes! Thanks a ton Adam. And again, sorry about the extra post. Won't happen
again Sir.

But maybe you could tell me ... why Char(13)+Char(10)? I would have expected
one or the other for some reason.

Rod

[quoted text, click to view]

Re: How to search and replace paragraph character in query Rod Gilchrist
1/25/2005 11:56:42 AM
Thanks Sue. Yes, I was using Chr instead of Char. Silly bugger that I am.

Rod

[quoted text, click to view]

Re: How to search and replace paragraph character in query Sue Hoegemeier
1/25/2005 12:47:57 PM
Are you using chr or char. In T-SQL, you'd want to use Char.
For example:

DECLARE @test as varchar(20)
SET @test = '123' + Char(13) + Char(10) + '456'

SELECT @test

SELECT replace(@test, Char(13) + Char(10), '')

-Sue

On Tue, 25 Jan 2005 10:37:01 -0800, "Rod Gilchrist"
[quoted text, click to view]
Re: How to search and replace paragraph character in query Rod Gilchrist
1/25/2005 1:13:40 PM
Cool. Thanks again.

[quoted text, click to view]

Re: How to search and replace paragraph character in query Adam Machanic
1/25/2005 2:41:55 PM
Did you try:

REPLACE(expression, CHAR(13)+CHAR(10), '')


--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--


[quoted text, click to view]

Re: How to search and replace paragraph character in query Adam Machanic
1/25/2005 3:07:49 PM
[quoted text, click to view]

Notice you referred to vbCrLf in your original post?

That stands for Visual Basic Carriage Return / Line Feed. CR =
CHAR(13), and LF = CHAR(10). Some other platforms only use one or the other
(just CR/CHAR(13) or just LF/CHAR(10)). Windows uses the combination. Note
that VB also has vbCr and vbLf functions.


--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--

AddThis Social Bookmark Button