Home Forums SQL Server 2005 T-SQL (SS2K5) replace single quotes in select statement RE: replace single quotes in select statement
James Raddock
Mr or Mrs. 500
Points: 569
More actions
June 3, 2008 at 4:57 am
#823517
I think what you're trying to do is insert a SQL string into a varchar text field.
You have to replace all the single quotes with '' to escape them [that's 2 single quotes]
Like so:
INSERT INTO
FOOD(Query)
VALUES
('Wheatie''s')