Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

maximum number of criteria arguments in SQL 1

Status
Not open for further replies.

Vie

Technical User
Jan 22, 2004
115
US
I have a SQL statement (in code) that I would like to be able to have as many OR arguments as needed. The arguments are supplied by a multi-select listbox and concatenated into the SQL string. Problem is, when the selection in the listbox gets up around 100 or 150 or so, I get the error message "query too complex." The query isn't really complex at all, it just has a lot of Where ID = 5 OR ID = 89 OR ID=216 etc.

What is the limit on arguments in a Where clause?

Is there another way to do what I'm trying to do?

Thanks in advance!
 
You can use IN ie WHERE ID IN (5,89,216...)

 
BNPMike,

THANKS SO MUCH! Didn't know about the IN keyword. Phew! Thanks a million,

Vie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top