PC Review


Reply
Thread Tools Rate Thread

How can I cancel a long-running query from my code in a differentthread

 
 
Big Daddy
Guest
Posts: n/a
 
      3rd Mar 2010
If I have a thread that running a long query, is it possible for a
different thread to cancel the query? I am using SQL Server and C#.
I have tried aborting the thread that is doing the query, and that
doesn't work. I have tried using a different thread to run a KILL
command on the SQL Server, and that is successful. But in order to
run a KILL command, I have to know the SPID of the query that should
be killed. I don't know how to get this. I am using the Entity
Framework for the long-running query. I am wondering if there's a way
to find the SPID of the query being run through EF. I could try to
run a query that says "select @@SPID" before running the long-running
query, but I don' know how to do this with my EF objects. Any ideas?

thanks in advance,
John
 
Reply With Quote
 
 
 
 
Dawid Łaziński
Guest
Posts: n/a
 
      5th Apr 2010
Hi,

Did you find any solution to your problem?

Regards,
David
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a long query Maury Markowitz Microsoft Excel Programming 1 30th Jan 2009 04:35 PM
Cancel button to quit long running function The_Contrarian Microsoft Access Form Coding 2 2nd Jun 2008 03:38 AM
Option to cancel long code execution MariahJ Microsoft Access 1 2nd Jan 2007 11:19 PM
How to cancel a long query HJ Rodirguez Microsoft ADO .NET 3 25th Mar 2004 02:56 AM
long running query... eNathan Microsoft ASP .NET 1 28th Oct 2003 08:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:26 PM.