1BEGIN TRANSACTION [Tran1]
2
3 BEGIN TRY
4
5 INSERT INTO [Test].[dbo].[T1] ([Title], [AVG])
6 VALUES ('Tidd130', 130), ('Tidd230', 230)
7
8 UPDATE [Test].[dbo].[T1]
9 SET [Title] = N'az2' ,[AVG] = 1
10 WHERE [dbo].[T1].[Title] = N'az'
11
12 COMMIT TRANSACTION [Tran1]
13
14 END TRY
15
16 BEGIN CATCH
17
18 ROLLBACK TRANSACTION [Tran1]
19
20 END CATCH
21
1--Applies to SQL Server and Azure SQL Database
2
3BEGIN { TRAN | TRANSACTION }
4 [ { transaction_name | @tran_name_variable }
5 [ WITH MARK [ 'description' ] ]
6 ]
7[ ; ]