alter trigger studentchufa_delete on studentchufa instead of delete as declare @count int select @count=count(*)from deleted declare @i int set @i=0 while @i<@count begin declare @code bigint declare @name varchar(50) declare @phone bigint declare @addresss varchar(50) select top 1 @code=code,@name=name,@phone=phone,@addresss=addresss from deleted where code not in(select top(@i) code from deleted) insert into studentchufabak values(@code,@name,@phone,@addresss) delete from studentchufa where @code=code set @i=@i+1 end go delete from studentchufa where code=1223061308 select *from studentchufabak
时间: 2024-10-11 09:01:17