We just ran into a problem with one of our stored procs throwing an error;
SELECT failed because the following SET options have incorrect settings: \'QUOTED_
I saved the following command to a textfile, then executed it with SQLCMD:
SET QUOTED_IDENTIFIER ON
SET QUOTED_IDENTIFIER OFF
Checking in SQL profiler, SQLCMD -i connects with the following connection options on my system:
-- network protocol: LPC
set quoted_identifier on
...
however the following command issued by SQLCMD when it connects:
SET QUOTED_IDENTIFIER OFF SET TEXTSIZE 4096
and then it runs my script.
So, the answer to 2) is no - running a script with SQLCMD -i is not the same as executing from SSMS (with the default connections options). If a script requires QUOTED_IDENTIFIER ON, then you need to explicitly set it at the start if you're going to execute it this way.