“在"Sql Server 中的子句限制 [英] "IN" clause limitation in Sql Server

查看:28
本文介绍了“在"Sql Server 中的子句限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道 IN 子句的表达式列表(以测试匹配)中的值数量的限制是多少?

Does anybody know what is the limit for the number of values one can have in a list of expressions (to test for a match) for the IN clause?

推荐答案

是的,有限制,但是 MSDN 仅指定它位于成千上万":

Yes, there is a limit, but MSDN only specifies that it lies "in the thousands":

在 IN 子句中包含大量值(数千个)会消耗资源并返回错误 8623 或 8632.要解决此问题,请将 IN 列表中的项目存储在表中.

Including an extremely large number of values (many thousands) in an IN clause can consume resources and return errors 8623 or 8632. To work around this problem, store the items in the IN list in a table.

详细查看这些错误,我们看到此限制并非特定于 IN,而是适用于一般查询复杂性:

Looking at those errors in details, we see that this limit is not specific to IN but applies to query complexity in general:

错误 8623:

查询处理器耗尽了内部资源,无法生成查询计划.这是一种罕见的事件,仅适用于极其复杂的查询或引用大量表或分区的查询.请简化查询.如果您认为自己错误地收到了此消息,请联系客户支持服务以获取更多信息.

错误 8632:

内部错误:已达到表达式服务限制.请在您的查询中寻找潜在的复杂表达式,并尝试简化它们.

这篇关于“在"Sql Server 中的子句限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆