简体   繁体   English

由于以下SET选项的设置不正确,导致由于INSERT而出错

[英]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.

相关问题 INSERT失败,因为以下SET选项的设置不正确:“ ARITHABORT”。 - INSERT failed because the following SET options have incorrect settings: 'ARITHABORT'. UPDATE失败,因为以下SET选项的设置不正确:'ARITHABORT' - UPDATE failed because the following SET options have incorrect settings: 'ARITHABORT' 无法打开文件,因为打开选项不正确 - cannot open the file because the open options are incorrect 将TextWrapping属性设置为WrapWholeWords时,获取参数是错误的错误? - Getting a parameter is incorrect error with TextWrapping property set to WrapWholeWords? 如何正确设置edgedriver? 得到以下错误 - how to set up edgedriver correctly? getting the following error 出现以下错误? - Getting following error? 是什么引起以下错误:','附近的语法不正确? - What causes the following error: Incorrect Syntax near ','? 应用程序无法启动,因为其并行配置不正确 - Application failed to start because its side-by-side configuration is incorrect 并排配置不正确,导致应用程序启动失败 - application has failed to start because the side by side configauration is incorrect 我有一组好的(正确的)rsa 密钥,但我得到“参数不正确”错误 - I have a good (correct) set of rsa keys and yet i get the "the parameter is incorrect" error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM