Set Implicit_transactions ON
PRINT @@TRANCOUNT
SELECT * FROM ORDERS
PRINT @@TRANCOUNT
COMMIT TRAN
--SELECT * FROM ORDERS
PRINT @@TRANCOUNT
BEGIN TRAN
PRINT @@TRANCOUNT
ROLLBACK TRAN
PRINT @@TRANCOUNT
---------------
0
(1 row(s) affected)
1
0
2
0
如何解释@@TRANCOUNT从0一下变成2???
帮顶
Set Implicit_transactions ON
PRINT @@TRANCOUNT
SELECT * FROM ORDERS
PRINT @@TRANCOUNT
COMMIT TRAN
--SELECT * FROM ORDERS
PRINT @@TRANCOUNT
BEGIN TRAN
PRINT @@TRANCOUNT
commit TRAN
PRINT @@TRANCOUNT
这时是
1
0
2
1