What it means
Filtered indexes, indexes on computed columns and indexed views store results that depend on how
expressions are evaluated, so SQL Server only maintains or uses them when the session has the standard
settings: ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL and
QUOTED_IDENTIFIER on, NUMERIC_ROUNDABORT off. (XML data type methods, spatial indexes and query
notifications have the same rule.) Your statement touched such an object with one of them wrong, so
SQL Server refused the statement and named the setting:
Msg 1934, Level 16, State 1, Server 7732422b7f56, Line 1
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.
The first word is the kind of statement (INSERT, UPDATE, DELETE, SELECT when a query uses
the index or view, CREATE INDEX). The table itself is fine. With ANSI_WARNINGS on, ARITHABORT
off didn’t matter in our tests, as Microsoft’s documentation says.
Common causes
sqlcmdwithout-I. The ODBC-basedsqlcmdconnects withQUOTED_IDENTIFIERoff unless you pass-I, so scripts and jobs run through it fail where other tools work.- A procedure, trigger or function created with
QUOTED_IDENTIFIERorANSI_NULLSoff. Those two settings are saved with the module when it’s created and used every time it runs, whatever the caller’s session says. A procedure deployed once from asqlcmdscript without-Ifails forever after, from every client. - Code that turns a setting off:
SET ANSI_NULLS OFForSET ANSI_WARNINGS OFFin an old script or procedure. - A new filtered index on an old table. Someone adds
CREATE UNIQUE INDEX … WHERE email IS NOT NULL, and legacy code that writes the table with old settings starts failing.
How to fix it
See which setting is off
The message names it. For a running application, look at its sessions:
SELECT session_id, program_name, quoted_identifier, ansi_nulls, ansi_warnings,
ansi_padding, arithabort, concat_null_yields_null
FROM sys.dm_exec_sessions
WHERE is_user_process = 1;
Seeing other sessions needs VIEW SERVER STATE (VIEW SERVER PERFORMANCE STATE on SQL Server 2022
and later).
Run sqlcmd with -I
sqlcmd -S <host> -U <user> -d <database> -I -i deploy.sql
Or put SET QUOTED_IDENTIFIER ON; at the top of the script, before any CREATE PROCEDURE.
Re-create modules that were created with the setting off
List them:
SELECT OBJECT_SCHEMA_NAME(object_id) + N'.' + OBJECT_NAME(object_id) AS module,
uses_quoted_identifier, uses_ansi_nulls
FROM sys.sql_modules
WHERE uses_quoted_identifier = 0 OR uses_ansi_nulls = 0;
Then run each definition again with both settings on. SET QUOTED_IDENTIFIER and SET ANSI_NULLS
must be in an earlier batch than the CREATE, since that statement has to be first in its batch:
SET QUOTED_IDENTIFIER ON;
SET ANSI_NULLS ON;
GO
CREATE OR ALTER PROCEDURE dbo.add_customer @name nvarchar(50), @email nvarchar(100) AS
INSERT INTO dbo.customers (name, email) VALUES (@name, @email);
GO
Leave the standard settings on
Remove SET ANSI_NULLS OFF, SET ANSI_WARNINGS OFF and similar from code. If something relied on
the old behaviour (= NULL comparisons that work with ANSI_NULLS off, say), fix that code; Microsoft
has said ANSI_NULLS OFF will become an error in a future version.
Reproduce it
On SQL Server 2022 (16.0.4295.3) with sqlcmd 18.6, a filtered unique index
UX_customers_email ON customers (email) WHERE email IS NOT NULL in a scratch schema. After
SET QUOTED_IDENTIFIER OFF, an insert, an update and a SELECT that forced the index:
Msg 1934, Level 16, State 1, Server 7732422b7f56, Line 1
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.
Msg 1934, Level 16, State 1, Server 7732422b7f56, Line 1
UPDATE 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.
Msg 1934, Level 16, State 1, Server 7732422b7f56, Line 1
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.
A procedure created while QUOTED_IDENTIFIER was off failed the same way when called from a session
with it on (… Procedure seo_err_mssql.add_customer, Line 2 INSERT failed …), and
sys.sql_modules showed it with uses_quoted_identifier 0. Re-created as above, it inserted the row
(in a transaction we rolled back). A DELETE, and creating a second filtered index, failed the
same way, as DELETE failed … and CREATE INDEX failed …. SET ANSI_NULLS OFF and
SET ANSI_WARNINGS OFF gave the same error naming 'ANSI_NULLS' and 'ANSI_WARNINGS'. Connected
with sqlcmd without -I, sys.dm_exec_sessions showed quoted_identifier 0 and the plain insert
failed with 1934; with -I it was 1 and the insert worked. SQL Server 2019 and 2025 printed the same messages.
In Inlet
When SQL Server refuses, Inlet shows its message with SQL Server error 1934, state 1, severity 16
and links to this page. A table’s definition shows its indexes, including filtered ones with their
WHERE, so you can see which index brings the rule in. Query tabs run T-SQL a batch at a time,
splitting at GO, so a script that sets the options and then re-creates a procedure runs as written.