Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL query with a quote/comma in one field of the query

Status
Not open for further replies.

SunStorm

IS-IT--Management
Feb 6, 2001
25
0
0
ES
Hi,
I have one sql query to access a oracle database, but in one field of the query there is a comma/quote in the string.
How can I remove the comma/quote from the field in the query?
Actually, the asp error is: there is a comma in the column.

Thanks. Thanks.
SunStorm
 
A classic problem is a quote in a sql statement:
sql = "update MyTable set field1 = 'bond's revenge'

you must replace every ' with two ''
sql = "update MyTable set field1 = 'bond''s revenge'

[When there are many fields, you should write a FixQuotes function that accepts a string and uses the replace() funtion]

A comma example:
sql = "update MyTable set Field1 = 'bond, james'"


br
Gerard
 
Thanks foxbox.

But I take the datas from other database and I can't modify the datas.
Actually, I'm trying with the Replace function on VBS.

Thanks for all.
SunStorm Thanks.
SunStorm
 
It was an UPDATE example, because then you'll have a common problem with quotes. You have a SELECT with a common/quote problem?
br
Gerard
 
It's an Insert with a quote problem, the server is timeouted, and not run

Thanks.
SunStorm Thanks.
SunStorm
 
>But I take the datas from other database and I can't
>modify the datas.

So you read from A and write into B. With replace() you must take care of the quotes. This will not *modify* the data.

suc6
br
Gerard
 
Thanks for your help. Thanks.
SunStorm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top