Is there any way to pass an array into an SQL statement and use the "IN" operator to match the items in the array? Or is there another way to approach this problem. I want to search the database for certain id's that will change in number each query.
what language are you using to access the database? no matter which one it is, just text edit the sql statement as a string and then pass that to the database
just stuff the array values into the sql statement like this
where id in ( i, j, k, l... )
the IN list method for choosing multiple rows in one statement is very efficient, especially if the field has an index in the database
Try posting your question in a forum for your dataabse product. The answer will vary from product to product. Terry L. Broadbent - DBA
SQL Server Page:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.