DROP TASK

Removes a task from the current/specified schema.

See also:

CREATE TASK , ALTER TASK , SHOW TASKS , DESCRIBE TASK

Syntax

DROP TASK [ IF EXISTS ] <name>
Copy

Parameters

name

Specifies the identifier for the task to drop. If the identifier contains spaces, special characters, or mixed-case characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive (e.g. "My Object").

If the task identifier is not fully-qualified (in the form of db_name.schema_name.task_name or schema_name.task_name), the command looks for the task in the current schema for the session.

Usage notes

  • When a task is dropped, any current run of the task (i.e. a run with an EXECUTING state in the TASK_HISTORY output) is completed. To abort the run of the specified task, execute the SYSTEM$USER_TASK_CANCEL_ONGOING_EXECUTIONS function.

  • The root task in a task graph must be suspended before any task in the task graph is dropped.

  • A standalone task can be dropped by the task owner (i.e. the role that has the OWNERSHIP privilege on the task) or a higher role without first suspending the task.

  • If a predecessor task in a task graph is dropped, then all former child tasks that identified this task as the predecessor become either standalone tasks or root tasks, depending on whether other tasks identify these former child tasks as their predecessor. These former child tasks are suspended by default and must be resumed manually.

Examples

Drop a task:

SHOW TASKS LIKE 't2%';


DROP TASK t2;


SHOW TASKS LIKE 't2%';
Copy

Drop the task again, but don’t raise an error if the task does not exist:

DROP TASK IF EXISTS t2;
Copy
Language: English