Article ID: 305333 - View products that this article applies to.
This article was previously published under Q305333
When you run a stored procedure or SQL INSERT statement directly, which attempts to insert a row into a table that is referenced in an indexed view, the following error may occur:
Furthermore, this error may occur even if "SET ARITHABORT ON" is included in the batch or stored procedure that attempts the INSERT.
INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'
To successfully insert a row into a table that is referenced in an indexed view, the SQL ARITHABORT configuration setting must be set to ON. Furthermore, the statement that applies this configuration setting must be executed in its own batch. Because stored procedures contain only one batch, adding the statement to the procedure does not work.
To resolve this problem, add the following ADO code to your application after you open the connection to your database:
where MyConnection is a reference to the ADO connection object you are using to run the stored procedure that performs an INSERT or the SQL INSERT statement.
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.
For more information, see the "Designing an Indexed View" and "Creating an Index" topics in SQL Server 2000 Books Online.
Article ID: 305333 - Last Review: May 8, 2003 - Revision: 2.2
Contact us for more help
Connect with Answer Desk for expert help.