Hi
I am trying to run a query in SQL 2008 by doing:
@query varchar(max)
SET @query = 'SELECT * FROM Table WHERE [Name] = ' 'Karl' ' '
EXEC(@query)
The problem is that for some reason the apostrophes around 'Karl'
don't get escaped, i.e. the query executes as ...WHERE [Name] = Karl
and fails.
Anyone have a suggestion?
Thanks
Karl