Click here to Skip to main content
16,004,833 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have created one webform(using C#).Onclick of button,I am executing query,showing time that sp take.I want to stop/kill that query.How to find out query which is executed by perticular user.I want to kill query of perticular user not other.How to do that?

What I have tried:

exec sp_who2 gives active.kill {SPID value} will kill sp. But how to find out which is exact sp of that user?
Posted
Comments
Not clear. What exactly you need?
Member 11589429 13-May-16 3:04am    
user 1 log into system,onclick of button exec query.I am showing time taken by that query.If to high,cancel/stop query from web application.
ZurdoDev 13-May-16 7:59am    
1. Reply to the comment so that the user is notified.
2. If you know how to call exec sp_who2 to get the SPID and then call KILL spid, what exactly is your question?
Richard Deeming 13-May-16 9:15am    
DBCC INPUTBUFFER(@SPID)[^] will tell you the last statement sent by the client on that particular session.

Is that what you're looking for?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900