anyone know what is the command to check un-commited transaction?
views:
308answers:
5
+9
A:
use @@trancount or sys.dm_tran_active_transactions DMV in sql 2005, 2008
Mladen Prajdic
2009-06-11 09:26:22
A:
@@trancount is the main one i use...
followed with ROLLBACK TRAN if its needed! ;)
kevchadders
2009-06-11 09:41:41
+2
A:
XACT_STATE() reports the transaction state of a session, indicating whether or not the session has an active transaction, and whether or not the transaction is capable of being committed. It returns three values:
- 1, The session has an active transaction. The session can perform any actions, including writing data and committing the transaction.
- 0, There is no transaction active for the session.
- -1, The session has an active transaction, but an error has occurred that has caused the transaction to be classified as an uncommittable transaction. The session cannot commit the transaction or roll back to a savepoint; it can only request a full rollback of the transaction. The session cannot perform any write operations until it rolls back the transaction. The session can only perform read operations until it rolls back the transaction. After the transaction has been rolled back, the session can perform both read and write operations and can begin a new transaction.
@@TRANCOUNT Returns the number of active transactions for the current connection.
- 0, not in a transaction
- 1, in a transaction
- n, in a nested transaction
KM
2009-06-11 14:17:46