Begin Tran??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bharadwajrv
    New Member
    • May 2007
    • 26

    #1

    Begin Tran??

    Hi i'm new to DB2...

    i'm writing two 'insert' statements, this should work as a single transaction...
    is there any command in DB2 to start the transaction (like Begin Tran)...

    Ex.
    Code:
    Insert into SchemaName.Table1 (field1, field2)
    Values ('test1', 'test12')
    
    Insert into SchemaName.Table2 (field1, field2)
    Values ('test22', 'test222') 
    
    Commit;
    will it work (even if AutoCommit is ON)?? or any change needs to be done?

    thanks in Adv.
  • frozenmist
    Recognized Expert New Member
    • May 2007
    • 179

    #2
    Hi,
    Dont set auto commit to ON. Use Commit; before and after the two insert statements. That way, only those two statements come under one transaction.

    Cheers

    Comment

    Working...