SQL Server - INSERT failed because of 'ARITHABORT'

S.M.Amin picture S.M.Amin · Feb 19, 2013 · Viewed 17.4k times · Source

I use NHibernate and SQL Server 2005 and I have an index on a computed column in one of my tables.

My problem is that when I insert a record to that table I get the following error:

INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'

I use SET ARITHABORT ON; before my inserts but still have this error.

Answer

muhmud picture muhmud · Feb 19, 2013

For inserts on tables with computed columns, you need these set options:

The NUMERIC_ROUNDABORT option must be set to OFF, and the following options must be set to ON:

ANSI_NULLS
ANSI_PADDING
ANSI_WARNINGS
ARITHABORT
CONCAT_NULL_YIELDS_NULL
QUOTED_IDENTIFIER

Try adding this before your insert:

set NUMERIC_ROUNDABORT off
set ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER on

insert ...