Simple method to constrain stored procedures by a collection

added by ccook
4/25/2012 5:30:42 PM


Passing a collection of ID's to filter a SQL query within a stored procedure is not natively supported. Consider this article which discusses methods for passing arrays into a stored procedure. Constraining a stored procedure's query has a simple work around, however. Passing the ID collection as a comma deliminated string allows the query to use LIKE to constrain the results. Note that the preceding and trailing commas are necessary. An example demonstrates how to do this easily.