Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 What happens when a connection breaks?

Author  Topic 

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2011-07-06 : 14:15:26
If an SQL statement or a Stored procedure is called and during execution, the connection is broken, what happens to the query or Procedure call? Could it complete? A rollback would occur?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-06 : 14:18:43
it should rollback unless completed before failure.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2011-07-06 : 14:24:31
quote:
Originally posted by visakh16

it should rollback unless completed before failure.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





And the same thing for a Select? When a session is disconnected during the query execution, would be the same as pressing the Stop Button from SSMS?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-06 : 14:26:47
yep. if session is disconnected you get an error stating that when you're running it in ssms

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2011-07-06 : 14:40:45
quote:
Originally posted by visakh16

yep. if session is disconnected you get an error stating that when you're running it in ssms

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





But say a WebServer requests a Select statement on the SQL Server and it is disconnected during processing of the Request - would SQL Server still processes anything in the background? Release it's locks right away?
Go to Top of Page
   

- Advertisement -