简体   繁体   中英

Maximum size of IN expression SQL Server

Do you know if there is a limit of the the numbers of elements we can write in a IN expression ? (with SQL Server)

ex :

SELECT *
FROM table
Where toto IN (1,2,3...., Max ?) 

thank you ;)

The Oracle SQL DB allows for a maximum of 1000 elements for in statements. However, you are not limited to 1000 elements if you use a select statement rather than specifying each element.

SELECT *
FROM table
Where toto IN (SELECT toto FROM other) 

I've used this when I have queries run for long periods of time that my otherwise timeout. This thread may also be helpful for you https://community.oracle.com/thread/235143

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM