sql CW - 数据库 - 按ID删除任务

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql CW - 数据库 - 按ID删除任务相关的知识,希望对你有一定的参考价值。

CREATE DEFINER="cw"@"%" PROCEDURE "removeTaskById"(v_taskid int)
BEGIN
   UPDATE task_pset_props SET value = TRIM(BOTH ';' FROM (select replace(';'||value||';',';'||v_taskid||';',';'))) WHERE NAME='taskid.list';
   DELETE FROM task_log WHERE taskid=v_taskid;
   DELETE FROM task_status WHERE taskid=v_taskid;
   DELETE FROM task_pset_props WHERE taskpsetid in (select taskpsetid FROM task_pset where taskid=v_taskid);
   DELETE FROM task_exec_props WHERE taskexecreqid in (select taskexecreqid FROM task_exec_req WHERE taskid=v_taskid);
   DELETE FROM task_exec_req WHERE taskid=v_taskid;
   DELETE FROM task_pset WHERE taskid=v_taskid;
   DELETE FROM task WHERE taskid = v_taskid;  
END

以上是关于sql CW - 数据库 - 按ID删除任务的主要内容,如果未能解决你的问题,请参考以下文章

SQL Oracle - 按 ID、任务 ID、最小和最大时间戳分组

请问一个MSSQl数据库,如何按id批量删除记录?

sql CW - 数据库 - 检查打开的连接

按 ID 删除节点的 Cypher 脚本是啥?

CW 警报维度中的参考实例 ID - Terraform

wpfs1065cw怎么样设定操作时间