gpt4 book ai didi

sql - "IN"Sql Server 中的子句限制

转载 作者:行者123 更新时间:2023-12-01 19:32:17 25 4
gpt4 key购买 nike

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

最佳答案

是的,有限制,但是Microsoft only specifies that it lies "in the thousands" :

Explicitly including an extremely large number of values (many thousands of values separated by commas) within the parentheses, 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, and use a SELECT subquery within an IN clause.

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

Error 8623:

The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

Error 8632:

Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.

关于sql - "IN"Sql Server 中的子句限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21178390/

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