Database Reference
In-Depth Information
Try It: What Happens When Both Operations Fail
In this example, you'll try to insert an invalid new person, in other words, one with a duplicate name,
and try to delete an undeletable one, in other words, one that has child records in the PersonDetails
table.
Add Pearl, and delete customer Rupag by entering the following statement, and then click the
Execute button:
exec sp_Trans_Test 'Pearl', 'Vamika', null,'Rupag'
The result should appear as in Figure 8-8.
Figure 8-8. Both operations rolled back
In the Messages pane shown in Figure 8-8, note that the transaction was rolled back (even though
neither statement succeeded, so there was nothing to roll back) because gmaxerr returns 2627 for the
INSERT and 547 for the DELETE . Error messages for both failing statements are displayed at the top of the
window.
 
Search WWH ::




Custom Search