1 create table test 2 ( 3 id int IDENTITY (1,1) PRIMARY KEY , 4 sjName VarChar(80) default null 5 ) 6 7 insert into test(sjName) values ('dsfs1'), ('dsfs2'), ('dsfs3'), ('dsfs4') 8 select * from test 9 10 Create PROCEDURE pro_test 11 @falg int, 12 @id varchar(200) 13 AS 14 BEGIN 15 if @falg=1 16 begin 17 declare @sql varchar(500) 18 set @sql='delete test where id in ('+@id+')' 19 execute(@sql) 20 end 21 END 22 GO