I have a few nested stored procedures, which have a while loop at the end. When I stop the query, the loop keeps running, though. Every child sp is independant from another and has a duration of less than 1s. Any ideas why it keeps running or how to properly cancel it?
SQL Server – Loop Inside Stored Procedure Doesn’t Stop After Query Cancellation
sql serverstored-procedures
Related Question
- MySQL While Loop Ending After Insert – Troubleshooting Guide
- Sql-server – SQL Server Agent Jobs – Long running job delaying other jobs
- Sql-server – SQL Server stored procedure running in infinite loop
- SQL Server 2016 – Why Doesn’t This Query Use an Index Spool?
- SQL Server: Execute Stored Procedure Inside Another from Linked Server
- Sql-server – Are stored procedure query texts stored in any tables
- Sql-server – Nested Stored Procedure Connections
Best Answer
You could have a look at running requests with either sp_whoisactive or with the below query and kill the session associated with the query / stored procedure.
Then you just execute the
KILL
command, like below, with the appropriate integer value from the above result, session which is associated with your stored procedure / query: