1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Controlling Transactions

Discussion in 'SQL Server' started by prashantSum, Sep 15, 2006.

  1. prashantSum

    prashantSum New Member

    Hi all,
    I want to controll transactions through query analyzer or stored procedure.
    I thought it can be controlled with 'begin transaction' and 'commit' or 'commit transaction' but I am unable achieve with it.

    I have two statements in my stored procedure first one is insert and next one is delete, even if insert is failing delete is getting executed successfully, so how can we controll transactions in MS SQL?
  2. shabbir

    shabbir Administrator Staff Member

    Why is the insert failing.
  3. prashantSum

    prashantSum New Member

    I was just testing with it, so I am trying to insert the a record with the same primary key.
    But what ever may be the case, I think transactions should be Atomic.

    I even tried to set auto commit false with
    set auto-commit = false
    but it's giving syntax error
  4. shabbir

    shabbir Administrator Staff Member

    Transaction is not that way atomic. Transaction gurantees that no other operation can occur in between your transaction on a particular record.

Share This Page