Wednesday 25 January 2012

SQL: Set Implicit Transactions SQL Server Manager

Question:
How to avoid or disable auto-commit for queries in SQLServer Manger?
How to set an implicit transaction scope for my queries? I want to commit them manually.


Answer:
When I'm working with SQL Server I'll usually use SQLServer Management Studio.
The manager has many options. And one option is called: SET IMPLICITE_TRANSACTIONS.
By default this option is set to OFF : If you do an INSERT you will insert something.
You can set this to ON: If you do an INSERT you have to do a manual COMMIT to commit the pending transaction.

You can do this for the manager
Tools / Options / Query execution / ANSI
Outil / Options / Execution de la requête / ANSI (dans ma version française)

Or just for the current query window
Query / Query Options / Execution / ANSI


No comments: