[英]Getting Error as INSERT failed because the following SET options have incorrect settings
My code inserts data which is passed as a XML from C# code behind which is working fine locally into SQL Server 2008 but on a remote instance of SQL Server 2005 it's throwing the following exception. 我的代码插入了从C#代码以XML形式传递的数据,其后在本地可以很好地在SQL Server 2008中正常工作,但是在SQL Server 2005的远程实例上,它引发以下异常。 Please help.
请帮忙。
CREATE PROCEDURE SqAnswersInsert @AnswerID INT OUTPUT,
创建过程SqAnswersInsert @AnswerID INT输出,
@ClientID INT=NULL,@ClientID INT = NULL,
@VGBID INT=NULL,@VGBID INT = NULL,
@CreatedOn DATETIME=NULL,@CreatedOn DATETIME = NULL,
@XmlOptions XML=NULL AS BEGIN@XmlOptions XML =空开始
SET ARITHABORT ON INSERT SqAnswers (ClientID, VGBID, [CreatedOn]) VALUES (@ClientID, @VGBID, @CreatedOn) SET @AnswerID=Scope_identity() INSERT INTO SqAnswerOptions (AnswerID, QuestionOptionID) SELECT @AnswerID,ABvalue('QuestionOptionID[1]', 'INT') AS QuestionOptionID --ABvalue('QuestionOptions/QuestionOptionID', 'INT') as QuestionOptionID FROM @XmlOptions.nodes('/QuestionOptions/Option') A(B) SET ARITHABORT OFF END
INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'.
INSERT失败,因为以下SET选项的设置不正确:“ ARITHABORT”。 Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.
验证SET选项是否正确用于计算列的索引视图和/或索引和/或过滤后的索引和/或查询通知和/或XML数据类型方法和/或空间索引操作。
When you have an Indexed View in your database, you must execute the SQL command 当数据库中有索引视图时,必须执行SQL命令
SET ARITHABORT ON
each time you connect to Microsoft SQL Server before executing any other SQL command. 每次连接到Microsoft SQL Server之前,请在执行任何其他SQL命令之前将
SET ARITHABORT ON
。
You can eliminate this error by deleting the indexes from your database views 您可以通过从数据库视图中删除索引来消除此错误
SET ARITHABORT Terminates a query when an overflow or divide-by-zero error occurs during query execution. SET ARITHABORT在查询执行过程中发生溢出或被零除错误时,终止查询。
From Technet 从Technet
1. If SET ARITHABORT is ON and SET ANSI WARNINGS is ON, these error
conditions cause the query to terminate.
2. If SET ARITHABORT is ON and SET ANSI WARNINGS is OFF, these error
conditions cause the batch to terminate. If the errors occur in a
transaction, the transaction is rolled back. If SET ARITHABORT is
OFF and one of these errors occurs, a warning message is displayed,
and NULL is assigned to the result of the arithmetic operation.
3. If SET ARITHABORT is OFF and SET ANSI WARNINGS is OFF and one of
these errors occurs, a warning message is displayed, and NULL is
assigned to the result of the arithmetic operation.
SET
ANSI_NULLS,
QUOTED_IDENTIFIER,
CONCAT_NULL_YIELDS_NULL,
ANSI_WARNINGS,
ANSI_PADDING
ON;
INSERT INTO TABLE(@CLOUMNS) VALUES(@VALUE)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.