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)
 Removing double quotes (") from strings

Author  Topic 

dln170
Starting Member

2 Posts

Posted - 2007-05-22 : 10:40:08
I am new to the Forum and have a question that I am hoping I can get some help with.

I am pulling data from our unix-based system through DTS into a postgres database that is used in our web site (Coldfusion).

Last week we ran into an issue where somebody entered data into our system that contained double quotes. It was OK for the databases but on the web site I am using that data in an array and when the code got to the first double quote it ended the array there and didn't continue to loop through the data properly.

I want to remove all occurances of double quotes in the move from our unix system to postgres in the DTS job. I assume this is done via a SQL REPLACE statement or something. For example, if I have:

"WHATEVER" in a field that I am selecting, I want it to appear in postgres as:

WHATEVER with no quotes.

The catch is that there are not usually quotes, this is a one in 100 occurance. The other thing is I can't assume the quotes will always be at the beginning and / or end.

Thanks in advance for your help!

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-22 : 10:47:52
Make use of REPLACE() function:

SELECT REPLACE('"WHATEVER"', '"','')


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dln170
Starting Member

2 Posts

Posted - 2007-05-22 : 11:00:25
Thanks, harsh_athalye! It seemed to work for me...
Go to Top of Page
   

- Advertisement -