Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What happens if a stored procedure is run in sql server management studio (SSMS 2012 to 2005 server) and it crashes?

I'm guessing the stored procedure continues to run?

On the other hand I have read somewhere that if a connection is lost and a transaction is used, then the transaction automatically rolls back?

share|improve this question

If connection is lost, your session will be closed and all transactions will be rolled back. If you want to run your procedure without interruption, you could execute it as a job.

share|improve this answer
Thanks @ibykov, so I assuming if there is no transaction then it continues on as normal? Or does it kill the process? – Alex KeySmith Mar 20 '13 at 17:00
No, it kills the process. But if you run in auto commit mode, all changes procedure made before the crash will be saved in database. – ibykov Mar 20 '13 at 17:12
It is also possible that procedure will be executed to the end, because Sql Server doesn't kill sessions immediately. – ibykov Mar 20 '13 at 17:22
Interesting thanks. – Alex KeySmith Mar 21 '13 at 9:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.