Link to home
Start Free TrialLog in
Avatar of koppcha
koppchaFlag for United States of America

asked on

Limit of selections in IN clause

In a SQL select statement what is the limit for choices that i can give in a IN clause.For instance in the following example
select * from titles where title_id IN ( a,b,c,d,.....How far can it go.) What is the limit.
Avatar of Jan Franek
Jan Franek
Flag of Czechia image

I haven't found any limit in manual, so I believe, that it's big enough :-) However, if you reach the limit, you can always by-pass it by storing your choices into some table and then use "select * from titles where title_id IN ( select choise from mychoices )"
ASKER CERTIFIED SOLUTION
Avatar of leonstryker
leonstryker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cckumar
cckumar

I infact tend to believe there is an inherent sybase limit for a list of items that are explicitly listed out in the in clause, but not for nested SQL statements.

The limit on 12.5 appears to be 439. Try it and let me know.

I am postively certain that on older versions this limit used to be 200 items. So appears as if it has been increased.

Thanks.
I can advise from experience that under 12.5.x that a list id 30 id's may not use the index, whereas 10 then 10 then 10 will always use the appropriate index.