- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我有一个存储过程,它接受一个 XML 参数并将数据插入到多个表中。如果我使用 SSMS 查询窗口将存储过程运行到数据库中,一切正常。但是,我们有一个自定义安装程序,用于将存储过程部署到数据库,当使用它时,sp 的执行失败并出现此错误:
INSERT failed because the following SET options have incorrect settings:
'ANSI_NULLS, QUOTED_IDENTIFIER'. Verify that SET options are correct for use with
indexed views and/or indexes on computed columns and/or query notifications
and/or xml data type methods.
在存储过程中编写脚本时,自定义安装程序未使用正确的设置。
在 sp 中设置这些(SET ARITHABORT ON; SET QUOTED_IDENTIFIER ON; SET ANSI_NULLS ON;)无效:
我还尝试在代码中调用 sp 之前为打开的连接设置这些选项。这又没有达到预期的效果。
似乎在数据库中运行 sp 时连接到数据库的设置才是最重要的,不是使用 sp 时的设置.
我已经尝试在 SSMS 选项中使用这些设置,结果确实如此。 我只是希望有人确认这确实是这种情况(如果有办法我很想听听,但我不抱希望)
不幸的是,目前我无法更改安装程序,因此我正在考虑不得不回滚几周的工作;所以如果我确实必须这样做,我想真正确定(并有一些证据支持我)这是唯一的选择
最佳答案
在 CREATE 或 ALTER 时应用的设置在运行时被忽略。
默认情况下,SSMS 具有正确的设置(sqlcmd、osql 等也是如此)。
来自 BOL, CREATE PROC
, "Using SET Options"
The Database Engine saves the settings of both
SET QUOTED_IDENTIFIER
andSET
when a Transact-SQL stored procedure is created or modified. These original settings are used when the stored procedure is executed. Therefore, any client session settings for
ANSI_NULLSSET QUOTED_IDENTIFIER
andSET
are ignored when the stored procedure is running. Other SET options, such as SET ARITHABORT, SET ANSI_WARNINGS, or SET
ANSI_NULLSANSI_PADDINGS
are not saved when a stored procedure is created or modified.
关于SQL Server 存储过程因使用 XML/ANSI_NULLS、QUOTED_IDENTIFIER 选项而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1713953/
我们刚刚遇到了一个问题,我们的存储过程之一抛出了错误; SELECT failed because the following SET options have incorrect settings:
我在 的帮助下实现了一个机制SqlDependency 这会提醒我特定数据库表中的任何更改。 但这破坏了我现有的功能,我正在更新已在其上实现 SqlDependency 的数据库表。 我收到以下错误:
我尝试在 PHPMyAdmin 中执行 SQL 语句,但收到一条错误消息: Error #1193 - Unknown system variable 'QUOTED_IDENTIFIER' SQL语
我目前正在使用 2008-r2 服务器上的旧式数据库,该数据库使用了很多创建时将带引号的标识符设置为关闭的对象。 我主要看这几种: CHECK_CONSTRAINT DEFAULT_CONSTRAIN
我有一个存储过程,在里面我有一个分页查询,它根据我所在的页面返回一组结果。 我有 DECLARE @Products TABLE()... then INSERT INTO @Products SEL
昨天,我在 MSSQL 2008 数据库中的 View 上添加了一些索引。之后,似乎所有存储过程都需要在 QUOTED_IDENTIFIER 设置为 ON 的情况下运行,即使是那些不使用相关 View
注意:我检查了 Understanding QUOTED_IDENTIFIER它没有回答我的问题。 我让我的 DBA 运行我在 Prod 服务器上创建的索引(他们查看并批准了它)。 它像我想要的那样加
所以我一直在创建脚本的时候盲目地使用ansi_nulls on,quoted_identifier on,因为sqlserver在脚本化对象的时候会自动生成它们.. 我真的没有时间关心这些琐碎的废话
有没有办法识别对象是在 SET QUOTED_IDENTIFIER 打开还是关闭的情况下创建的? (不仅是这个设置选项,我还在寻找一个脚本来识别与该对象关联的所有 ANSI 设置) 这是对 staac
我安装了 Visual Studio 2012,并安装了 SSDT 版本 11.1.20627.0。 一直困扰我的问题之一是我在 SSDT 项目中尝试使用模式比较将其推送到服务器时的所有存储过程。 S
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 9 年前。 Improv
我有一个存储过程,它接受一个 XML 参数并将数据插入到多个表中。如果我使用 SSMS 查询窗口将存储过程运行到数据库中,一切正常。但是,我们有一个自定义安装程序,用于将存储过程部署到数据库,当使用它
任何人都可以对此提供见解吗? 我开发了一个使用 XML 数据类型的导入过程。在通过 import sProc 将数据插入表后,我运行另一个过程以使用导入的表更新另一个表。 如果使用 SET QUOTE
我在更新存储过程时遇到问题。错误是: UPDATE failed because the following SET options have incorrect settings: 'QUOTED_
在执行存储过程时,我们有时会收到以下消息,之后无需任何更改,删除并重新执行存储过程,它就可以正常工作。 DBCORE INSERT failed because the following SET o
喜欢others previously ,今天在我的 SQL 日志中我可以看到计划的作业由于错误 1934 而无法执行。 ALTER INDEX failed because the followin
当我尝试在表上重建索引时: ALTER INDEX ALL ON [dbo].[Allocations] REBUILD 效果很好。 但是当我打电话时 EXECUTE sp_msForEachTabl
当我右键单击/修改时,如何防止 SQL Management Studio (10.50.2500.0) 将其添加到每个存储过程的开头? SET ANSI_NULLS ON GO SET QUOTED
我有一个脚本来删除数据库中的所有表,如下所示: -- Disable all constraints EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CON
我有一个 SQL Server Dockerfile,我的 import-data.sh 从 sql-data 文件夹导入 *.sql 文件。如果我从 Datagrip 之类的工具运行 *.sql 文
我是一名优秀的程序员,十分优秀!