CREATE PROCEDURE deleteAccountAll @id int AS SET XACT_abort ON BEGIN DISTRIBUTED TRAN delete from AccountCapital where accountid = @id delete from logininfo where username = @id delete from CapitalRecord where accountid = @id delete from [Trade]..[order] where accountid = @id delete from account where id = @id if @@error<>0 rollback tran else commit tran GO