Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   Controlling Transactions (http://www.go4expert.com/forums/controlling-transactions-t1402/)

prashantSum 15Sep2006 10:45

Controlling Transactions
 
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?

shabbir 15Sep2006 11:09

Re: Controlling Transactions
 
Why is the insert failing.

prashantSum 15Sep2006 11:12

Re: Controlling Transactions
 
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

shabbir 15Sep2006 14:18

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


All times are GMT +5.5. The time now is 04:10.