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

Characters that SQL Server does not like

Status
Not open for further replies.

awhitsel

Programmer
Feb 22, 2001
80
US
I am working on a VB program that is using several SQL statements intermingled into it.

On of these statements is taking exception to a statement in a VB text box.

At my last job, I was told that there certain characters that SQL Server just doesn't like, such as apostrophes (which is what this statement had), but there others, such as hyphens and double quotes.

Could you please confirm this problem with apostrophes, hyphens, and double quotes?

Thank you.
 
Need to see the code that is handling the text from your text box. The " and ' may be the culprit.

Thanks

J. Kusch
 
It's not that SQL Server doesn't 'like' certain symbols, it's that SQL Server uses them for something other than what they are grammatically meant for.

For example: an underscore (_) is used as a wild-card in SQL Server. Same with the percent sign (%).

Single apostrophe is used to mark text (ie CHAR/VARCHAR). Example: WHERE myfield = 'Hello'

-SQLBill
 
JayKusch: Here is the code where the problem is occurring:

strSQL = "UPDATE CY48_REPORT_A SET INJURIES='" Trim(ml_conditions.Text) & "' WHERE SESSION_ID=" & lf_session

For security reasons, I an unable to show you the actual statement in the text box, but what I am able to tell you is that one of the statements contains an apostrophe and two commas. The second statement contains two double quotes, and a hyphen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top