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

How to INSERT a string that contains single quotes

Status
Not open for further replies.

hapax

Programmer
Nov 10, 2006
105
US
How can I write SQL to do the following:

UPDATE Comments
SET Comment='it's great'
WHERE UserID='joe' AND GameID='503'

This code as-is generates an error from the 'it's great' due to the quotes problem it has. Is there a way to escape the single quote in the string or something?

Much thanks
 
Use double single quotes. Look for RED.

UPDATE Comments
SET Comment='it'[red]'[/red]s great'
WHERE UserID='joe' AND GameID='503'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top