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

前端 未结 6 1177
闹比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 04:01

    declare a @temp table and split the values into it. then you could do

    select * from Studio s inner join @temptable tb on s.ID=tb.ID

提交回复
热议问题