I'm executing one stored procedure from the '.net' code. Since there is a lot of data, it is taking too much time to execute. Is there any way to stop this execution from the c# code?
In other words, if we execute the query from database itself, there is a option to stop its execution but in the code is it possible?
SQL Server Management Studio Activity Monitor Scroll down to the SPID of the process you would like to kill. Right click on that line and select 'Kill Process'. A popup window will open for you to confirm that you want to kill the process.
To stop a queryRight-click anywhere in the Results pane, on the shortcut menu point to Pane, and then click Clear Results.
The Cancel Query Execution or Fetch button enables a long-running SQL query to be interrupted and control returned to Toad. To be able to cancel queries, you must select the Execute Queries in Threads option by choosing Main Menu → View → Toad Options → Oracle → Transactions, as shown in Figure 5.14.
Yes sqlcommand.cancel is your friend http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.cancel.aspx
Yes, you can cancel the query by using SqlCommand.Cancel
. However, the command must be running in another thread (otherwise Cancel will be called only after the command is finished).
Also you can specify a CommandTimeout
if you want to cancel this query when it runs over a specified time limit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With