English (UK)

T-SQL Transaction

/* Quick Transaction */
BEGIN TRAN
 UPDATE myTable SET myField = 'Test' WHERE myId = 1
ROLLBACK TRAN
COMMIT TRAN

/* Extended Transaction */
BEGIN TRANSACTION CandidateDelete
GO
USE AdventureWorks2008R2
GO
UPDATE myTable SET myField = 'Test' WHERE myId = 1
GO
COMMIT TRANSACTION CandidateDelete
GO
ROLLBACK TRANSACTION CandidateDelete
GO

 


© 2017 Bruno Tessaro. My life in the web. All right reserved.