Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

First Statement issued by SQL Server Agent is SET QUOTED_IDENTIFIER OFF

$
0
0
We were debugging a production issue where a new SQL Agent job threw the following error:[i]INSERT 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. [SQLSTATE 42000] (Error 1934). The step failed.[/i]We do have an indexed view on one of the tables being updated, and also our script worked when run directly from Management Studio, so a bit of research brought one of our team members to this post on Stack Overflow: [u][url]http://stackoverflow.com/questions/15218893/first-statement-issued-by-sql-server-agent-sets-quoted-identifier-off[/url][/u]So, we added [b]SET QUOTED_IDENTIFIER ON;[/b] as the first line of the T-SQL job step, and that fixed the problem. By the way, I did verify that Quoted Identifier was enabled for the database in question.This brings up two questions:1. Is this really true? Does the SQL Agent really set [b]QUOTED_IDENTIFIER OFF;[/b] for T-SQL job steps? I did not find any mention of this in the MSDN article for QUOTED_IDENTIFIER: [u][url]https://msdn.microsoft.com/en-us/library/ms174393.aspx[/url][/u]2. Why would this be the default for SQL Agent? I've been cautioned always against using non-default ANSI settings without a compelling reason. (Laziness does not count as a "compelling" reason.) What was the rationale behind this design decision?If anyone knows, I would be grateful for your insight. :-)

Viewing all articles
Browse latest Browse all 6525

Trending Articles