SQL : in clause in stored procedure:how to pass values

前端 未结 8 1931
小蘑菇
小蘑菇 2020-11-27 18:12

I want to write a SQL Server 2005 stored procedure which will select and return the user records from the user table for some userids which are passed to the stored procedur

8条回答
  •  无人及你
    2020-11-27 18:52

    Just use it like this will work

    Create procedure sp_DoctorList 
    @userid varchar(100)
    as 
    begin
    exec ('select * from doctor where userid in ( '+ @userid +' )')
    end
    

提交回复
热议问题