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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql string

Status
Not open for further replies.

Albano

Instructor
Joined
Dec 11, 2000
Messages
221
Location
PT
Hello I have a problem with single qouotes, in may database I have records with single qouotes
eg: segundo de ângulo (''), and an SQl string like this:
strSQL2="UPDATE GLOSSARIO SET TERMO_PESQUISA=''" & temp & "'' where ID=" & Rs("ID") & ""

So my problem is how can i use the single qouotes in the sql instructions without confliting with the single qouotes in the record.

Any ideas ?

Thanks Albano

 
Check faq220-109 in the ANSI SQL forum for some answers.

Basically you need to either replace every embedded single quote with two single quotes - fred's becomes fred''s.

Or you can use double quotes to delimit the SQL string. However, if you do that you must SET QUOTED_IDENTIFIERS OFF or SQL will interpret the double quotes as column name delimiters.

Example 1:
Select * from tbl where name like 'fred''s'

Example 2:
SET QUOTED_IDENTIFIERS OFF
Select * from tbl where name like "fred's"
Terry

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top