How to Stop a query from Auto Committing in Microsoft SQL Server Management Studio.

By default Microsoft SQL Server Management Studio Query (Query Analyzer) auto commits leaving no option to rollback.  I had been very use to this and preferred it this way, however, recently I had been working in an environment with different tools where explicit commit was the preferred way and so now I want the flexibility of both in SQL Server as well.

One option is to turn on implicit transactions at the beginning of your query using  “set implicit_transactions on”.  When this is on, you will still see all of the updated or inserted row counts when executing your query, but you will have the option to rollback or commit.

Another way is to turn on implicit transactions by default within SQL Server Management Studio.

  1. Tools –> Options
  2. Expand Query Execution –> SQL Server
  3. Select ANSI

JUST BECAREFUL.  Don’t leave a transaction open because it may end up blocking other users.  Always make sure to commit or rollback.

MSDN Ref –

Explore posts in the same categories: SQL Server


You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: