• I believe the problem with the original statement was how SQL Server handles single. vs. double quotes. In your code, SQL Server was getting confused between the single quote starting the data value and the double quote included within the data value.. The SET QUOTED IDENTIFIER setting would only affect that as intended if the double quotes were only around the outside of the whole command string. The solution (doubling up the single quotes) has always worked, but can be annoying in some situations and can make the code hard to read. Sometimes you even need three or more single quotes to achieve the desired results.

    J Pratt