Last active
August 29, 2015 13:57
-
-
Save nisar1/9595619 to your computer and use it in GitHub Desktop.
transaction in sp mssql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create procedure uspContactPersonDeleteSingleItem | |
@id int | |
as | |
begin tran | |
delete from address where contactpersonid = @id; | |
if @@ERROR <> 0 | |
begin | |
rollback tran | |
return -1 | |
end | |
delete from emailaddress where contactpersonid = @id; | |
if @@ERROR <> 0 | |
begin | |
rollback tran | |
return -1 | |
end | |
delete from phonenumber where contactpersonid = @id ; | |
if @@ERROR <> 0 | |
begin | |
rollback tran | |
return -1 | |
end | |
delete from contactperson where id = @id ; | |
if @@ERROR <> 0 | |
begin | |
rollback tran | |
return -1 | |
end | |
commit tran | |
go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment