- Categories:
System functions (System Control)
SYSTEM$CANCEL_ QUERY¶
Cancels the specified query (or statement) if it is currently active/running.
- See also:
Syntax¶
Arguments¶
query_idIdentifier for the query to cancel. To obtain the ID for a query executed within the last 14 days, log into the web interface and go to the History
page.
Usage notes¶
-
A user can cancel their own running SQL operations using this SQL function. Canceling running operations executed by another user requires a role with one of the following privileges:
- OWNERSHIP on the user who executed the operation.
- OPERATE or OWNERSHIP on the warehouse that is running the operation (if applicable).
- ACCOUNTADMIN role.
-
For a query run by a task, canceling running operations requires a role with one of the following privileges:
- OPERATE or OWNERSHIP on the task that is running the operation.
- ACCOUNTADMIN role.
-
Snowflake query IDs are UUID text strings with hyphens, which are special characters, so the strings must be escaped by using single quotes.
-
This function is not intended for canceling queries for a particular warehouse or user. Instead, use: