none
Stop the stored procedure execution RRS feed

  • Question

  • Hi,
    We can stop the stored procedure execution in sql query analyzer.

     

    But, in running application, can we stop the stored procedure execution while execution is running (in C#)?


    Thanks in advance.

    Thursday, September 13, 2007 11:12 AM

All replies

  • Call your SP from the new async thread, when you want to cancel the query kill the thread. One of easy way..

    Otherwise you have to notedown the your current spid of the SQL Server. When you want to cancel the execution use the KILL command with your SPID.

     

    Thursday, September 13, 2007 11:58 AM
  • Hi,

     

    I can kill the thread but transaction rollback will first execute the SP and then it's doing rollback the transaction.

     

    I can't stop SP execution in middle or from running state.

     

    I am using .Net 2005 (C#) and SQL Server 2005. How can I stop the execution of SP from C# code?

    Thursday, September 13, 2007 12:18 PM