Wednesday, March 21, 2012

Incorrect settings Arithabort

INSERT [DELETE] failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods.

On local dev machine with SQL Express DB everything works fine. Once moved to shared hosting environment (with adjustments to web.config), insert and delete stored procedures produce the above error.

Made sure that stored proceduresSETARITHABORTON at the beginning and OFF at the end, without success. Even SET ARITHABORT ON at DB level without success.

Suggestions appreciated

Have a look at

http://msdn2.microsoft.com/en-us/library/aa259212(SQL.80).aspx|||

Thanks for the reply. After the original post, I continued rummaging for a solution. Found a comment that related the error to the connection string. Remember that the problem only occured when the app moved to a shared hosting environment. So I added the SqlCommand below after opening the connection.

public override bool DeleteCategory(int categoryID) {using (SqlConnection cn =new SqlConnection(this.ConnectionString)) { SqlCommand cmd =new SqlCommand("Directory_DeleteCategory", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@.CategoryID", SqlDbType.Int).Value = categoryID; cn.Open();//adding next 2 lines eliminated the error SqlCommand arithabortCmd =new SqlCommand("SET ARITHABORT ON", cn); arithabortCmd.ExecuteNonQuery();int ret = ExecuteNonQuery(cmd);return (ret == 1); } }
The stored procedure is very simple typical delete.
Added those to lines to all INSERTS, UPDATES and DELETES. It works, although I still don't understand why turning ARITHABORT on at the stored procedure and database level does not.
Again thanks,

No comments:

Post a Comment