Conditional Failed because the followng SET operations has incorrect settings: 'ARITHABORT'
I got this error when trying to drop and create an index on a table.
Create failed for index IX_USER_ID (Microsoft.SQLServer.Smo)
Additional Information
An exception occured while executing a transact sql statement or batch
(Microsoft.SQLServer.ConnectionInfo)
Conditional Failed because the followng SET operations has incorrect settings: 'ARITHABORT'
Verify that SET operations are correct for use with indexed views and /or indexes on computed columns and/or query notifications and/or xml data type methods (Microsoft SQL Server Error 1934)
Oh my bad, I knew this was a case to set SET ARITHABORT ON if you generate such statement from a ODBC or OLEDB provider or even though the statment is included in the batch or stored procedure that attempts the INSERT.
Eventually that still continues in SQL Server 2005 as SET ARITHABORT ON is one of the options that is not automatically set for connections that use the OLE DB Provider for SQL Server or the SQL Server ODBC driver. Because OLE DB and ODBC connections do not specify an ARITHABORT setting, connections default to the server default, which is ARITHABORT OFF. So I would suggest to define any SET operations within your code, executing a USE statement within a request to change the current database results in all subsequent requests executing under the new context. Similarly, changing the value for a SET option within a batch would imply that all subsequent executions would run under the newly set value.
Also this is similar in when you are trying to access indexed views and indexed computed columns, there are a couple of settings that must be on: ANSI_NULLS, ANSI_WARNINGS, ANSI_PADDING, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER and ARITHABORT. All these
settings are also ON by default - except for ARITHABORT!
The error message shown (Msg 1934) is returned when the table is created with the right ANSI_NULLS values and the index is created with a wrong one. If the table is created with a wrong setting, and you try to then create an index on a computed column in the table, you will get such errors.
So to recover from this issue you can takeup the following methods:
sp_configure 'user options', 64
reconfigure
or include
SET ARITHABORT ON
... at the beginning of that script or stored procedure
or
ALTER DATABASE db SET ARITHABORT ON
for complete setting on the database.
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.