Articles → SQL SERVER → Autocommit Transactions In SQL Server

Autocommit Transactions In SQL Server






What Are Auto-Commit Transactions?







Enable Auto-Commit Mode




SET IMPLICIT_TRANSACTIONS OFF



Prerequisite




Picture showing the schema of the database table





Case 1: When T-SQL Statement Contains Compile Time Error




Set identity_insert TestTable On 

Insert into [dbo].[TestTable] values(1,'Test1')
Insert into [dbo].[TestTable] values(1,'Test2')

Set identity_insert TestTable Off







Case 2: Invalid Object Name (Or Other Run Time Error)




Set identity_insert TestTable On 

Insert into [dbo].[TestTable] (Id, Name) values(1,'Test1')
Insert into [dbo].[TestTable1] values(2,'Test2')

Set identity_insert TestTable Off






Picture showing the error when the query is trying to be executed on non-existent table



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, October 10, 2017

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250