Create Window Failed Index In Use

KB/Media/0000799/00002s.png' alt='Create Window Failed Index In Use' title='Create Window Failed Index In Use' />INSERTUPDATE failed because the following SET options have incorrect settings QUOTEDIDENTIFIER In this article we will discuss on when we get the errors like below in Sql Server and how to resolve them. Msg 1. 93. 4, Level 1. State 1, Procedure Add. Employee, Line 5. INSERT failed because the following SET options have incorrect settings QUOTEDIDENTIFIER. Verify that SET options are correct for use with indexed views andor indexes on computed columns andor filtered indexes andor query notifications andor XML data type methods andor spatial index operations. First to reproduce this scenario we will create a demo db, table, populate sample data in the table and create a stored procedure to add the data to table CREATE DATABASE Demo. SQLHints. USE Demo. SQLHints. SET ANSINULLS ON. CREATE TABLE dbo. Create Window Failed Index In Use' title='Create Window Failed Index In Use' />EmployeeEmployee. Id int identity1,1. British Airways Flight 5390 was a scheduled passenger flight operated by British Airways between Birmingham Airport in England and Mlaga Airport in Spain. First. Name VARCHAR5. Last. Name  VARCHAR5. Insert 1k records using GO statement as below. INSERT INTO dbo. EmployeeFirst. Name,Last. Name VALUESNEWID,NEWID. Create Stored Procedure to insert record in Employee Table with. QUOTEDIDENTIFIER setting set to OFF. The Lancashire Grid for Learning provides a variety of educational resources, content and managed services to support schools in maximising the benefits of technology. Beware. This specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further. This section describes. Find authoritative content such as technical articles and whitepapers for a specific product. SET QUOTEDIDENTIFIER OFF. CREATE PROCEDURE DBO. Add. EmployeeFirst. Name VARCHAR5. 0,Last. Name VARCHAR5. 0. SET NOCOUNT ON. INSERT INTO dbo. EmployeeFirst. Name,Last. Name. VALUES First. Name, Last. Name. GOBelow statement to insert record in the Employee table, successfully executes and inserts a record in the employee table EXEC DBO. Add. Employee Basavaraj,Biradar. GONow try to create a filtered index New Feature introduced in Sql Server 2. To create filtered index, sql server requires it to be created with SET QUOTEDIDENTIFIER setting as ON. SET QUOTEDIDENTIFIER ON. CREATE NONCLUSTERED INDEX IXEmplyoeeEmployee. Upcoming Epic Games Games. Id. ON EmployeeEmployee. Id WHERE Employee. Id 5. 00. GOAfter creating the above filtered index, try executing the below statement which was executed successfully prior to the creation of the filtered index. EXEC DBO. Add. Employee Basavaraj,Biradar. GOThis time the execution of the above statement returns the below error Msg 1. Level 1. 6, State 1, Procedure Add. Employee, Line 5. INSERT failed because the following SET options have incorrect settings QUOTEDIDENTIFIER. Verify that SET options are correct for use with indexed views andor indexes on computed columns andor filtered indexes andor query notifications andor XML data type methods andor spatial index operations. Reason for this error is  Employee table has filtered index and due to this any DML statement on this table which is executed with SET QUOTEDIDENTIFIER setting as OFF will result in failure. Here as the stored procedure Add. Employee is created with SET QUOTEDIDENTIFIER setting as OFF, so whenever this sp is executed it will use this setting stored in the meta data. To solve this issue, we need to re create the SP Add. Employee  with QUOTEDIDENTIFIER setting as ON as shown below DROP PROCEDURE dbo. Add. Employee. SET QUOTEDIDENTIFIER ON. CREATE PROCEDURE DBO. Add. EmployeeFirst. Name VARCHAR5. 0,Last. Name VARCHAR5. 0. SET NOCOUNT ON. INSERT INTO dbo. EmployeeFirst. Name,Last. Name. VALUES First. Name, Last. Name. GONow, try executing the below statement EXEC DBO. Add. Employee Basavaraj,Biradar. GONow, the above statement executes successfully and inserts a record in the employee table You would also like to gothrough the article SET Options with their setting values required while working with filtered index. Please go through the article SET QUOTEDIDENTIFIER ONOFF Setting in Sql Server to have detailed information on this setting. It is better practice to use SET QUOTEDIDENTIFIERS ON setting. Please correct me, if my understanding is wrong. Comments are always welcome. Note All the examples in this article are tested on Sql Server 2. ALSO READ Difference Between SET QUOTEDIDENTIFIER ON and OFF setting. Doc. Comment. Xchange.