Skip to content

Commit 7a4f0d6

Browse files
committed
We may have found a defect in mssql 2017 related to starting a transaction (BEGIN TRAN) only within a try-catch block invalidating the transaction.
1 parent bd5d474 commit 7a4f0d6

4 files changed

Lines changed: 26 additions & 365 deletions

File tree

Experiments/Experiments.ssmssqlproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
<AssociatedConnUserName />
6767
<FullPath>LIKE4000.sql</FullPath>
6868
</FileNode>
69+
<FileNode Name="MSSQL Defect Try-Catch Invalidates Transaction.sql">
70+
<AssociatedConnectionMoniker />
71+
<AssociatedConnSrvName />
72+
<AssociatedConnUserName />
73+
<FullPath>MSSQL Defect Try-Catch Invalidates Transaction.sql</FullPath>
74+
</FileNode>
6975
<FileNode Name="NameResolutionResearch.sql">
7076
<AssociatedConnectionMoniker />
7177
<AssociatedConnSrvName />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
PRINT 'No TRY...CATCH:';
2+
EXEC ('BEGIN TRAN');
3+
SELECT XACT_STATE() AS [XACT_STATE()],@@TRANCOUNT AS [@@TRANCOUNT];
4+
GO
5+
IF(XACT_STATE()<>0)ROLLBACK;
6+
GO
7+
8+
9+
10+
GO
11+
PRINT 'In TRY...CATCH:';
12+
BEGIN TRY
13+
EXEC ('BEGIN TRAN');
14+
END TRY
15+
BEGIN CATCH
16+
END CATCH;
17+
SELECT XACT_STATE() AS [XACT_STATE()],@@TRANCOUNT AS [@@TRANCOUNT];
18+
GO
19+
IF(XACT_STATE()<>0)ROLLBACK;
20+
GO

Experiments/StartHere 2021-12-20 B.sql

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)