با درود

begin
Begin tranaaction
Insert code...
if @@error <> 0
begin
Rollback transaction
End
Else
Begin
Commit transaction
End

End