I'm writing a utility to correct some data that involves 3 tables in 2 
separate DBCs. I want to wrap the whole thing in a transaction and only 
commit my changes if the update succeeds in all 3 tables. My first 
thought was to nest the tableupdates and commit or rollback after each 
tableupdate. Something like this:

...(pseudo-code)
BEGIN TRANS
IF TABLEUPDATE(table1)
 IF TABLEUPDATE(table2)
  IF TABLEUPDATE(table3)
   END TRANS
  ELSE
   ROLLBACK
  ENDIF
 ELSE
  ROLLBACK
 ENDIF
ELSE
 ROLLBACK
ENDIF
...

But then I thought why not put all 3 tableupdates in an IF statement 
like this:

...(pseudo-code)
BEGIN TRANS
IF TABLEUPDATE(table1) AND  TABLEUPDATE(table2) AND TABLEUPDATE(table3)
 END TRANS
ELSE
 ROLLBACK
ENDIF
...

In particular, I'm wondering how transactions work when multiple DBCs 
are involved. Any opinions/caveats on the pros & cons of each of these 
approaches? I'm most concerned with data integrity as opposed to 
performance as this will (hopefully) be a one-time fix.

TIA

-- 
Richard Kaye
Vice President
Artfact/RFC Systems
Voice: 617.219.1038
Fax:  617.219.1001

For the fastest response time, please send your support
queries to:

Technical Support - [EMAIL PROTECTED]
Australian Support - [EMAIL PROTECTED]
Internet Support - [EMAIL PROTECTED]
All Other Requests - [EMAIL PROTECTED]

---------------------------------------------------------
This message has been checked for viruses before sending.
---------------------------------------------------------



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to