有个存储过程这样的:Create procedure........AS delete from table1 where id in(@id)
然后程序中有个方法 其中调用存储过程 并传参数 @ID 程序中的@ID 是‘1,2,3,4,5’这样的格式,id是int 类型 请问我该如何 写这个存储过程 急求 谢谢~~
有个存储过程这样的:Create procedure........AS delete from table1 where id in(@id)
然后程序中有个方法 其中调用存储过程 并传参数 @ID 程序中的@ID 是‘1,2,3,4,5’这样的格式,id是int 类型 请问我该如何 写这个存储过程 急求 谢谢~~
delete from table1 where id in(
SELECT t.c.value('.','int')
FROM (
SELECT ID = CAST ('' + REPLACE(@id, ',', '') + '' AS XML)
) r
CROSS APPLY ID.nodes ('/ID') t(c)
)