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

sql server new users

group:

Help Please!! Job depends on it!!


Help Please!! Job depends on it!! Ray
11/17/2005 11:06:05 AM
sql server new users:
Can anyone tell me how to remove a comma ',' from a text field? I am coping
records to a csv and it is separating my text field into two columns when it
finally reaches the CSV. SQL Server 2000 SP4. It is also wrapping some
rows to 2 or 3 lines.

My query I am using is:
Select notes
from rn_appointments
results:

1 Row should Read: How do you, do
It is coming out as:
Col 1 Row 1 Col2 Row 2
How do you do

I tried:
UPDATE rn_appointments
SET notes = REPLACE(notes, ',', '')

and got this error:
Server: Msg 8116, Level 16, State 1, Line 1
Argument data type text is invalid for argument 1 of replace function.

I checked BOL and couldn't understand what to use.

Thanks.

--
Re: Help Please!! Job depends on it!! Adam Machanic
11/17/2005 3:47:49 PM
http://www.sqlteam.com/item.asp?ItemID=15528


--
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--


[quoted text, click to view]

Re: Help Please!! Job depends on it!! Ray
11/18/2005 8:34:31 AM
Thanks Adam.

That helped get rid of the comma ',' and now I am working on getting rid of
crlf, data exceeding the length of the field, etc.

I found that you can copy the table to access, save the file to a txt,
import the file back into access and it lets you clearn all the bad stuff at
once. Then you can import the table back to sql all cleaned up.

What is your opinion on doing this? I know it is now standard SQL.
--
Ray


[quoted text, click to view]
AddThis Social Bookmark Button