CANCEL
Cancels a running query based on its specific query identifier. The system cancels query execution at the next available pause point, such as between batches of data processing. If the execution of theCANCEL SQL statement fails, you can force the query to terminate immediately by using the KILL SQL statement.
To view active queries and their identifiers, see the sys.queries table.
A CANCEL statement can return these statuses.
Required Privileges
Users must have system-level
UPDATE privileges to cancel queries.
Syntax
SQL
Examples
Cancel a specific query with the
9a9eb7e3-3440-4814-871f-7f0584ac2fd8 identifier.
SQL
KILL
Kills a running query identified by its UUID. This SQL statement performs a forceful termination of the query, aborting execution regardless of its current stage. If you want to attempt a more gradual query termination that stops processing at the next pause point, use the CANCEL SQL statement. To view active queries and their identifiers, see the sys.queries table.
Required Privileges
Users must have system-level
UPDATE privileges to kill queries.
Syntax
SQL
Example
Kill a specific query based on the UUID
9a9eb7e3-3440-4814-871f-7f0584ac2fd8.
SQL

