create procedure a as delete from tb where id=?execute a
Create proc Del_P ( @ID int ) SET XACT_ABORT on ; begin tran delete table1 where ID=@ID delete table2 where ID=@IDcommit trango 或用 begin try begin tran... commit tran end try begin catch select ERROR_MESSAGE() rollback tran end catch
create procedure a as
delete from tb where id=?execute a
@ID int
)
SET XACT_ABORT on ;
begin tran
delete table1 where ID=@ID
delete table2 where ID=@IDcommit trango
或用
begin try
begin tran...
commit tran
end try
begin catch
select ERROR_MESSAGE()
rollback tran
end catch