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

Single Quotes - causing probelms

Status
Not open for further replies.

sdempsey

Programmer
Mar 23, 2005
36
0
0
GB
I have the following line of SQL:-


set @sqltxt = 'INSERT INTO ' + @lookup_table + '([Description],
Code:
,[Entered_By]) Values('''+@description+''','''+@code+''','''+@person+''')'

The probelm is that the descriptions may contain single quotes and cause the compiler to complain that I have not closed them. So the statement reads:-

NSERT INTO Lookup([Description],[Code],[Entered_By]) Values(''vaccination','99','person')

Is there anyway around this?

Thanks in advance 

Sarah
 
Replace() all single quotes with two...

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top