Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one question rlated to SQL-Transaction, I have 4 tables in the database and primary key of first table should aapear as an attribute in all three tables, here I'm using SQL-transaction to insert the data in all four tables. I have inserted data in first table and taken the last inserted value (primary key value) using @@identity and now I'm trying to insert the data in all three tables along with first table's primary key value but while inserting the data in thired table there is error has accured...now I want to rollback all inserted data from first and second tables. for that I have rollback it in cache block...the question is here,yet commit statement has not executed so I want to know whether data in first and second tables physically inserted or logically , if physically then rollback action internally delete the data and delete the log as well...is it true?? and if logically then what will be the internal process in that case..??.where data will stored logically...??
Posted
Updated 20-Jan-11 22:10pm
v2

1 solution

 
Share this answer
 
Comments
Dylan Morley 21-Jan-11 4:31am    
Good links. OP should state what database platform he is using (e.g. SQL2005 or later?), if so then TRY-CATCH is the way to go!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900