create procedure p1 as begin begin tran truncate table a truncate table b commit end go
DECLARE @ERR INT SET @ERR=0 BEGIN TRAN truncate table a SET @ERR=@ERR+ABS(@@ERROR) truncate table b SET @ERR=@ERR+ABS(@@ERROR) IF @ERR=0 COMMIT ELSE ROLLBACK
create procedure truncate_table as begin begin tran truncate table a truncate table b commit end go
as
begin
begin tran
truncate table a
truncate table b
commit
end
go
SET @ERR=0
BEGIN TRAN
truncate table a
SET @ERR=@ERR+ABS(@@ERROR)
truncate table b
SET @ERR=@ERR+ABS(@@ERROR)
IF @ERR=0
COMMIT
ELSE
ROLLBACK
create procedure truncate_table
as
begin
begin tran
truncate table a
truncate table b
commit
end
go