I need to run SQL query on a SQL Server database from command line, the following query run on SSMS without any issue. first I created a file (MyScript.sql):
CREATE FUNCTION dbo.udf_tokenize(@input VARCHAR(MAX))
RETURNS VARCHAR(MAX)
AS
BEGIN
RETURN (SELECT CAST('<r><![CDATA[' + @input + ' ' + ']]></r>' AS XML).value('(/r/text())[1] cast as xs:token?','VARCHAR(MAX)'));
END
GO
UPDATE dbo.PMDOCS
SET SDESC = dbo.udf_tokenize(SDESC);
Then I run a sqlcmd on the command line:
sqlcmd -S EC2AMAZ-5UNBD90 -d miadmfggp_live -i "C:\MyScript.sql"
I got the following error:
SELECT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.
Please advise how to fix it. Thanks