471,073 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

trouble with sql query and quotes

I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks
Nov 12 '05 #1
2 1373
I solved this by passing sourcefield to a function that replaces the single
quote with 2 quotes.

"Danny" <da********@hotmail.com> wrote in message
news:Kw*******************@news4.srv.hcvlny.cv.net ...
I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks

Nov 12 '05 #2
for x = 1 to infinity
print "Thank you"
next x

LOL, thanks a ton, that did it
"paii, Ron" <pa**@packairinc.com> wrote in message
news:10*************@corp.supernews.com...
I solved this by passing sourcefield to a function that replaces the single quote with 2 quotes.

"Danny" <da********@hotmail.com> wrote in message
news:Kw*******************@news4.srv.hcvlny.cv.net ...
I am doing this on a table in a database.

sql query = "select all names where instr(sourcefield,searchstring) > 0"

this fails when there is embedded quotes in sourcefield such as

"the book entitled "The Sun Shines" is a book about..."

how to handle this?

thanks


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Penn Markham | last post: by
3 posts views Thread by Dr. Oz | last post: by
5 posts views Thread by Fernando Rodríguez | last post: by
9 posts views Thread by JJM0926 | last post: by
12 posts views Thread by Todd Michels | last post: by
9 posts views Thread by Nathan Sokalski | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.