473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1428
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
13
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine....
3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
5
by: Fernando Rodríguez | last post by:
Hi, I'm sending the follwoing query to mysql from a php script: ---------------------------------------------------------------------------------------- INSERT INTO affiliates (aff_id,...
3
by: mukeshhtrivedi | last post by:
Hi Gurus, I have created simple query as SELECT QUOTES.DATE, QUOTES.QUOTENO, QUOTES.SALESREP, QuoteItem.ITEM, QUOTES., QUOTES.CUSTOMER, QUOTES.AMOUNT, QUOTES., QUOTES.DivisionID,...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
12
by: Todd Michels | last post by:
Hi all, I am trying to send data from a form and insert it into a MSSQL DB. When I submit the data I get: Warning: mssql_query() : message: The name "Todd" is not permitted in this context....
9
by: Nathan Sokalski | last post by:
I am trying to use the System.Array.ForEach method in VB.NET. The action that I want to perform on each of the Array values is: Private Function AddQuotes(ByVal value As String) As String Return...
5
9815402440
by: 9815402440 | last post by:
hi i am using acess 2003 as back end of my application. database was fine a few days back. i have a table named Ac_LedgerMaster. i have several tables that are related to this table. now relations...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.