Transaction question

Last Post 09 Aug 2010 10:46 AM by gunneyk. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
river1
New Member
New Member

--
28 Jul 2010 11:54 PM

Hi masters,

   Suppose i have this query



insert
into Table2
select * from table1


Now, suppose that when i'm inserting data from table1 into table2 one of the records fails when inserting.
All the previous records that where already inserted will be committed? or the entire transaction will be rolled back because of one record that failed to be inserted?


Thank you,

    Pedro

Note , i do not have the begin trans and commit trans in my query window, so it's in auto commit mode, i think...

russellb
New Member
New Member

--
29 Jul 2010 07:44 AM
The entire statement will fail, so zero records will be inserted
gunneyk
New Member
New Member

--
09 Aug 2010 10:46 AM
Russell is correct but just wanted to add that any individual Insert , Update or Delete is always ATOMIC by themself and will either succeed and everything affected will be committed or if it has any failure it will roll back any changes that were encurred during that statement.
You are not authorized to post a reply.

Acceptable Use Policy