Wednesday, October 12, 2011

SQLCMD - QUOTED_IDENTIFIER is OFF

If you want to deploy the Differential script on a Database in an automated way, the most common way is to use SQLCMD. For example:

sqlcmd -S Server-d Database1 -U UserName -P Password -i DatabaseBuild-ProdDiff.sql

However, when you run this script, QUOTED_IDENTIFIER is set to OFF

When running the stored procedures, you might see errors like:
Message: UPDATE failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'.

The reason for this is that QUOTED_IDENTIFIER is not set to ON
To set it to ON, you should pass the -I argument, For example:
sqlcmd -I -S Server-d Database1 -U UserName -P Password -i DatabaseBuild-ProdDiff.sql

2 comments: