gpt4 book ai didi

SQL Server 2008 SET QUOTED_IDENTIFIER OFF 问题

转载 作者:行者123 更新时间:2023-12-05 00:11:55 27 4
gpt4 key购买 nike

我有一个存储过程,在里面我有一个分页查询,它根据我所在的页面返回一组结果。

我有

DECLARE @Products TABLE()... then INSERT INTO @Products SELECT ROW_NUMBER()...

一切正常,但是当我的产品名称中带有单引号或双引号时,它不会显示在结果中。 SET QUOTED_IDENTIFIER 已关闭。当我删除引号时它可以工作,但是当我再次添加它们时它不会出现。

我的解决方案是什么?

最佳答案

您的 proc 是否正在调用 indexed view在任何情况下?

索引 View 取决于设置为 ON 的 SET QUOTED_IDENTIFIER。在使用 WITH (NOEXPAND) 显式使用它们的情况下,proc 会适得其反,否则它也可能会停止,因为它会将其视为普通 View 。见以下article on MSDN .

Stored procedures and triggers should be written to work with the six SET options that are required to support the indexes on views and computed columns. The query optimizer does not use an index on a view or computed column in SELECT statements that are executed by a stored procedure or trigger when the SET options are incorrectly set. An INSERT, UPDATE, or DELETE statement in the stored procedure or trigger that modifies data values stored in the indexed view or computed column generates an error.

关于SQL Server 2008 SET QUOTED_IDENTIFIER OFF 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5627897/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com