Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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 Key Mar 20 '13 at 17:00
1  
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
1  
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 Key Mar 21 '13 at 9:33

Your Answer

 
discard

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.