SQL - Stored Procedure with Select Statement using IN (@Variable_CommaDelimitedListOfIDS)

前端 未结 7 2239
无人及你
无人及你 2020-12-17 02:42

I am creating a stored procedure to which I want to pass as variable a comma delimited list of Ids. I want to use the Ids into a select statement, something like:



        
相关标签:
7条回答
  • 2020-12-17 03:14

    Everyone seems to be doing something like this today!

    Have a look at http://www.sqlteam.com/article/parsing-csv-values-into-multiple-rows - this is a way of processing a delimited input variable to give a results set containing the split items by joining against a numbers / tally table (which is a good thing to have in the database anyway if you haven't yet). This then gives you a simple results set which you can join against as per normal.

    0 讨论(0)
提交回复
热议问题