存储过程怎样接收多个参数??
我想用存储过程挑出id=2,3,6,9这几行的数据,然后绑定在datalist上
请问应该怎么些存储过程呢?
------解决方案--------------------select * from table1 where id like '%1,2,3,4%
------解决方案----------------------参数传递逗号分隔的字符串 如: "1,2,3,4 "
create procedure test(@par varchar)
as
select * from table where id in (@par)
------解决方案--------------------CREATE PROCEDURE Test
@idString NVARCHAR(1000)
AS
DECLARE @sql NVARCHAR(2000)
SET @sql = "UPDATE Images SET 是否专辑=1 WHERE (ImageID IN ( ' " + @idStrings + " ') "
exec @sql
@idStrings从你上面的代码组合,形式如下:
imgeid1,imageid2,imageid3