distal-attribute
distal-attribute
distal-attribute
distal-attribute

BUG: Kill running query when user doesn't have admin privileges

igitur posted 4 months ago in General

Hi,

On most of the MS SQL servers that I use I don't have admin / sa privileges. Sometimes I have a long running query that I want to stop. If I press the stop button, the kill command is sent to the server. I get a permission denied error for that and HeidiSQL throws an exception (I can attach it if you want). The problem is that from then on HeidiSQL is very unstable and a lot of actions cause exceptions. I'm also unable to close that tab, because HeidiSQL says a query is currently running.

I suspect a proper absorption of any exceptions thrown by the kill command would solve it.

Francois

ansgar posted 4 months ago

r5124 now catches such exceptions within executing the KILL command.

igitur posted 4 months ago

The exception on the kill command is now caught, but HeidiSQL still thinks the query is running.

ansgar posted 4 months ago

Well it is running, when the KILL command did not succeed, doesn't it?

igitur posted 4 months ago

Ah OK. You're right. It is actually still running. How does SSMS stop the queries then? In SSMS I just hit the stop button and the query stops with message "Query was cancelled by user."

igitur posted 4 months ago
/* Affected rows: 0  Found rows: 22 825  Warnings: 0  Duration for 1 query: 01:05:16 */

See why I want to kill the query? ;)

ansgar posted 4 months ago

Hehe. Well, take a coffee, or two, or have a talk with your colleagues :)

igitur posted 4 months ago

Haha, I do that a lot.

But seriously, is there no way to at least abandon the query? I'm not sure, but I think that's what SSMS does when you press the stop button and don't have privileges to kill the query... I think it just abandons the SQL command, but that it actually continues running on the server. Would that be possible in HeidiSQL?

ansgar posted 4 months ago

The only chance for me is to kill the connection then programmatically, without SQL. That would destroy the old session and create a new one. But that cannot be the intention of a "Cancel running query" button.

Please login to leave a reply, or register at first.