Sign Up Now!Log In
Joel 10/27/2011 10:58:53 AM

How to parse a comma separated string into a SQL table

* This article, and all our great SQL (General) documentation, Is available on the SQL (General) menu

In SSRS, there is a limitation that you cannot pass a multivalue parameter to a stored procedure. I read a couple of ways to get around that, the best being this one from Mark Vaillancourt. The ‘Scooby Do’ references are pretty funny. Ruh roh.


In the spirit of laziness, I wanted a slightly simpler answer. I prompt the use to enter a comma separated list of customers, and parse them into a table in SQL. Then, I join that table to the customer master table in my application. Or you could do a ‘WHERE CUSTNMBR IN (SELECT CUSTNMBR FROM @MYTABLE)’

Version: Unknown or N/A
Section: SQL Scripts