Can a stored procedure have dynamic parameters to be used in an “IN” clause?

前端 未结 6 1178
闹比i
闹比i 2020-12-06 03:29

I want to run a query like this:

 SELECT * FROM Studio WHERE Id IN (134, 144, 132, 138, 7432, 7543, 2566)

but the amount of Id<

6条回答
  •  温柔的废话
    2020-12-06 03:43

    Solution described here:

    Arrays and Lists in SQL Server 2005

    An SQL text by Erland Sommarskog, SQL Server MVP

    http://www.sommarskog.se/arrays-in-sql-2005.html

提交回复
热议问题