SQL Server-由于“ ARITHABORT”,INSERT失败 [英] SQL Server - INSERT failed because of 'ARITHABORT'
问题描述
我使用NHibernate和SQL Server 2005,并且在我的一张表中的计算列上有一个索引。
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失败,因为以下SET选项的设置不正确:'ARITHABORT'
I在插入之前使用 SET ARITHABORT ON;
,但仍然出现此错误。
I use SET ARITHABORT ON;
before my inserts but still have this error.
推荐答案
对于具有计算列的表上的插入,您需要以下设置选项:
For inserts on tables with computed columns, you need these set options:
NUMERIC_ROUNDABORT选项必须设置为OFF,并且以下选项必须设置为ON:
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 ...
这篇关于SQL Server-由于“ ARITHABORT”,INSERT失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!