DECLARE @SQL Varchar(Max)
DECLARE @DESCR Varchar(Max)
-- Customer enters description into @Descr
SET @SQL = 'Update TableName SET FieldName='''
+ @DESCR
+ ''' WHERE ID=123'
The problem is when the customer enters an apostrophe into the @Descr variable.
Q: In Microsoft SQL Server 2005, how do I replace all apostrophies with double apostrophe?