SQL 存储过程传入多个ID
代码
Declare @UserIDList VarChar(20),
@SQL NVarChar(200)
Set @UserIDList='1,2,3'
Set @SQL='Select * from Member Where UserID IN('+@UserIDList+')'
--使用拼写的SQL语句,然后使用Sp_ExecuteSQL
Exec Sp_ExecuteSQL @SQL
@SQL NVarChar(200)
Set @UserIDList='1,2,3'
Set @SQL='Select * from Member Where UserID IN('+@UserIDList+')'
--使用拼写的SQL语句,然后使用Sp_ExecuteSQL
Exec Sp_ExecuteSQL @SQL