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之前,我还尝试为open连接设置这些选项.这再次没有达到预期的效果.
看来,当sp运行到数据库时,与数据库连接的设置是重要的,而不是使用sp时的设置.
我已经通过在SSMS选项中使用这些设置进行了实验,这似乎就是这种情况.我希望有人确认这是绝对的情况(如果有一种方法我会喜欢听到它,但我没有希望)
不幸的是,改变安装程序对我来说当前不是一个选择,所以我期待不得不回滚几周的工作;所以,如果我必须这样做,我想确定(并有一些证据支持我),这是唯一的选择
默认情况下,SSMS具有正确的设置(sqlcmd,osql等也是如此).
从BOL,CREATE PROC
,“Using SET Options”起
The Database Engine saves the settings
of bothSET QUOTED_IDENTIFIER
andSET
when a Transact-SQL stored
ANSI_NULLS
procedure is created or modified.
These original settings are used when
the stored procedure is executed.
Therefore,any client session settings
forSET QUOTED_IDENTIFIER
andSET
are ignored when the stored
ANSI_NULLS
procedure is running. Other SET
options,such as SET ARITHABORT,SET
ANSI_WARNINGS,or SETANSI_PADDINGS
are not saved when a stored procedure is created or modified.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。