I have a
SELECT statement which is hanging and I would like to kill it. I am accessing the server through a SQL GUI if that matters (not microsoft's).
Is there a command I can execute to kill that process?
I get this when using
EXEC('Kill ' + Pid):
KILL command cannot be used inside user transactions.</blockquote> Answer1:
You could try the <a href="http://msdn.microsoft.com/en-us/library/ms173730%28v=sql.105%29.aspx" rel="nofollow">
If KILL command alone does not work, like you constantly get "<em>KILL command cannot be used inside user transactions.</em>" errors, then take your database
BACKONLINE again. This will force a full disconnect of any lingering processes on your database.
Do not do DEATTACH, as that is "overkill" and could jeapordise bringing your database back online.
If it's a production database, obviously <strong>think</strong> before you do this!