SQL Server - INSERT failed due to "ARITHABORT"

I am using NHibernate and SQL Server 2005, and I have an index in a computed column in one of my tables.

My problem is that when I insert a record into this table, I get the following error:

INSERT error because the following SET parameters have incorrect settings: "ARITHABORT"

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

+5
source share
5 answers

To insert into tables with calculated columns, you need the following parameters:

The NUMERIC_ROUNDABORT parameter must be set to OFF, and the following parameters must be set to ON:

ANSI_NULLS
ANSI_PADDING
ANSI_WARNINGS
ARITHABORT
CONCAT_NULL_YIELDS_NULL
QUOTED_IDENTIFIER

:

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

insert ...
+5

( ) , : https://support.microsoft.com/en-us/kb/305333

, ,

sqlConn = New SqlConnection(connectionString)
If sqlConn.State = ConnectionState.Closed Then sqlConn.Open()

sqlCmd = New SqlCommand()
With sqlCmd
   .Connection = sqlConn
   .CommandType = CommandType.text
   .CommandText = "SET ARITHABORT ON"
   .ExecuteNonQuery()

   .CommandType = CommandType.StoredProcedure
   .CommandText = "MY PROCEDURE"
   .ExecuteNonQuery()
End With

, -.

+1

, SET

    ALTER DATABASE [$(DatabaseName)]
        SET ANSI_NULLS OFF,
            ANSI_PADDING OFF,
            ANSI_WARNINGS OFF,
            ARITHABORT OFF,
            CONCAT_NULL_YIELDS_NULL OFF,
            NUMERIC_ROUNDABORT OFF,
            QUOTED_IDENTIFIER OFF 
        WITH ROLLBACK IMMEDIATE;
0

SQL Server Mgt Studio, , "", "" ",

0

All Articles