精华内容
下载资源
问答
  • 任务计划没有按触发器设定自动运行 场景分析: 1、公司设定每天都需要每隔30分钟或15分钟进行无期限循环运行自动化脚本!!! 2、手动运行是正常的!!! 3、偶尔第一次触发运行是正常的!!! 4、运行一段时间后不...

    Windows 任务计划不运行 && 任务计划只运行一次 && 任务计划没有按触发器设定自动运行

    场景分析:

    1、公司设定每天都需要每隔30分钟或15分钟进行无期限循环运行自动化脚本!!!
    2、手动运行是正常的!!!
    3、偶尔第一次触发运行是正常的!!!
    4、运行一段时间后不运行了!!!
    5、修改了任务计划后出现按计划运行!!!

    错误触发器配置

    在这里插入图片描述

    正确触发器配置

    在这里插入图片描述

    相信看到上面两张图很多读者已有答案了,在这给出上面两个触发器的说明:

    错误配置与正确配置的触发器说明

    错误分析

    任务计划运行异常,大部分在于以下三种情况导致:

    一、触发器配置出现问题:

    如上面的,看着设置的触发器没有问题,实际上,触发器设置上产生了冲突,导致了不会自动按设定的计划运行脚本!!!设置触发器的时候一定要注意设定时不要产生内部计划冲突!!!

    二、操作的启动程序问题:

    1、脚本的路径不存在
    2、脚本的路径太深(切换路径排除这个问题)
    3、脚本的权限设置问题(登录运行用户手动运行排除这个问题)
    4、脚本本身错误(通过手动运行脚本排除这个问题)
    5、脚本对应的参数设置错误(这种情况较少!)

    三、运行用户设定问题:

    1、运行用户的权限是否足够
    2、运行用户是否被禁用(建议设定后台用户跑任务)

    注:

    另外提一个,在设定每隔一定时间间隔运行时,请考虑运行的脚步所需的时间!!!
    即:运行脚本时间 大于 任务运行时间间隔

    ·
    ·
    ·
    作者说明:写文档,就用心写到最好,供大家阅读!!!

    展开全文
  • 通常来说计划任务触发器会比简单触发器的使用频率高很多。如果你的任务是需要基于日历每天定时运行,那你就应该使用计划任务触发器,例如每周五中午12:00执行任务,或者每天早上9点执行任务计划任务表达式...

    通常来说计划任务触发器会比简单触发器的使用频率高很多。如果你的任务是需要基于日历每天定时运行,那你就应该使用计划任务触发器,例如每周五中午12:00执行任务,或者每天早上9点执行任务。

     

    计划任务表达式(Cron Expressions)

    计划任务需要使用计划任务表达式(Cron Expressions)来定义。计划任务表达式是一个字符串,它又7个子字符串组合而成,这7个子字符串有空格符间隔,分别表示计划任务触发时间的7个部分

     

    第一位 –  触发时间的秒数

    第二位 –  触发时间的分钟数

    第三位 –  触发时间的小时数

    第四位 –  触发日期是一个月中的哪几天

    第五位 –  触发月份是哪几个月

    第六位 –  触发日期是一周当中的哪些天(周一 – 周日)

    第七位 –  触发的年份(可选参数), 用的比较少

     

    例如:
     0 0 12 ? * WED

     

    表示每周三中午12:00执行一次任务

     

    计划任务表达式的7位子字符串,每一位都可以使用范围表达式或者指定值

     

    可选值

    第一位

    0-59

    第二位

    0-59

    第三位

    0-23

    第四位

    0-31

    第五位

    JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV,DEC或者0-11

    第六位

    SUN, MON, TUE, WED, THU, FRI, SAT或者1-7, 1表示周日。这里也可以使用范围, 例:”MON-FRI”, “MON-WED, SAT”

     

     

     

     

     

    通配符

    计划任务表达式中可以使用通配符

     

    通配符

     

    *

    所有可选值

    ?

    表明没有特定值,只能用于第四位(day of month)和第六位(day of week)

    /

    增量,例如分钟位字符串0/15,表示从0开始,每15分钟触发一次,即每当分钟数为0,15,30,45时候触发任务

    L

    只能用于第四位(day of month)和第六位(day of week)

    ·         L单独使用在第四位,表示指定月份的最后一天

    ·         L 单独使用在第六位,表示周六

    ·         L 使用在第四位,但是前面有指定数字,表示指定月份的倒数第几天,例如6L, 就是指定月份的倒数第6天

    ·         L使用在第六位,但是前面有指定数字,表示指定月份的最后一个周几,例如FRIL, 表示指定月份最后一个周五

    W

    只能用于第五位, W在这里的意思就是取指定月份离指定之天最近的Weekday(Mon-Fri), 例如15W, 表示离指定月份第15天最近的非周末日期

    #

    只能用于第六位,表示指定月份的第几个星期的某天,例如6#3, 或者FRI#3都是表示指定月份的第三个周五

     

     

    一些表达式的例子

    "0 0/5 * * * ?"

     

    每5分钟运行一次任务,永不停止,除非触发器指定了EndAt

     

    "10 0/5 * * * ?"

     

    每5分钟又10秒,运行一次任务,永不停止,除非触发器指定了EndAt

     

    "0 30 10-13 ? * WED,FRI"

     

    每周周三周五,10:30, 11:30, 12:30, 13:30各运行4次任务,永不停止,除非触发器指定了EndAt

     

    "0 0/30 8-9 5,20 * ?"

     

    每个月的5号,20号,上午8:00,8:30, 9:00, 9:30各运行4次任务,永不停止,除非触发器指定了EndAt

     

     

    使用代码创建计划任务触发器

     

    使用TriggerBuilder的WithCronSchedule方法,可以很容易的生成一个计划任务触发器

     

    例:

    TriggerBuilder.Create()
    
        .WithIdentity("trigger3", "group1")
    
        .WithCronSchedule("0 0/2 8-17 * * ?")
    
        .ForJob("myJob", "group1")
    
        .Build();

     

    转载于:https://www.cnblogs.com/lwqlun/p/9095112.html

    展开全文
  • 1、创建定时任务(事件计划)实例: #查看当前是否已开启事件调度器 show variables like 'event_scheduler'; #要想保证能够执行event事件,就必须保证定时器是开启状态,默认为关闭状态 set global event_scheduler =...

    1、创建定时任务(事件计划)实例:
    #查看当前是否已开启事件调度器
    show variables like 'event_scheduler';
    #要想保证能够执行event事件,就必须保证定时器是开启状态,默认为关闭状态
    set global event_scheduler =1;
    #或者set GLOBAL event_scheduler = ON;
    # 选择库
    use qdqg;
    # 如果原来存在该名字的任务计划则先删除
    drop event if exists schedule_301;
    delimiter $$
     # 每天晚上01:00
    create event schedule_301  
    on schedule every 1 DAY   starts timestamp '2017-04-24 10:00:00'
    # 测试使用 1 hour
    on schedule every 1 HOUR starts TIMESTAMP(NOW())
    do
    begin
        INSERT INTO st_result_1000010301 (`EQ_CODE`, `EQ_NAME`, `SENDTIME`, `STRESS1`, `TEMPER1`, `STRESS2`, `TEMPER2`, `STRESS3`, `TEMPER3`, `STRESS4`, `TEMPER4`, `STRESS5`, `TEMPER5`, `STRESS6`, `TEMPER6`, `STRESS7`, `TEMPER7`, `STRESS8`, `TEMPER8`, `STRESS9`, `TEMPER9`, `STRESS10`, `TEMPER10`, `STRESS11`, `TEMPER11`, `STRESS12`, `TEMPER12`) VALUES ('01001', '71#门机下部运行部分', TIMESTAMP(NOW()), '-3028.319', '32.088', '-418216.535', '58.137', '-2719.388', '32.172', '-3538.113', '-47080.239', '92.281', '42.140', '57.788', '37.733', '-129.595', '41.816', '-177.516', '31.064', '-271.865', '-47301.560', '73.067', '-46122.387', '-271.865', '-47301.560', '73.067', '-46122.387');
    end  $$
    delimiter ;
    # 停止
    ALTER EVENT schedule_301 DISABLE;
    # 开启
    alter event schedule_301 enable;
    # 查看状态
    select * from mysql.event;

    2、创建触发器实例:

    delimiter $$
    create TRIGGER UPDATE_301 AFTER INSERT
    ON st_result_1000010301 FOR EACH ROW
    BEGIN
    DECLARE eq_code VARCHAR(40) CHARACTER set utf8;
    DECLARE eq_name VARCHAR(40) CHARACTER set utf8;
    SET eq_code=new.EQ_CODE;
    SET eq_name=new.EQ_NAME;
    IF eq_code='01002' OR eq_name='56#lower' or eq_name='71#lower'
    THEN UPDATE st_result_1000010301 SET EQ_CODE='01001',EQ_NAME='71#门机下部运行部分' WHERE ID=new.ID;
    END IF;
    END $$

    delimiter ;

    展开全文
  • 定时任务 查看event是否开启: ...将事件计划开启: set global event_scheduler=1; 关闭事件任务: alter event e_test ON COMPLETION PRESERVE DISABLE; 开户事件任务: alter event e_test ON COMPLETION PRESERVE

    定时任务
    查看event是否开启: show variables like '%sche%';
    将事件计划开启: set global event_scheduler=1;
    关闭事件任务: alter event e_test ON COMPLETION PRESERVE DISABLE;
    开户事件任务: alter event e_test ON COMPLETION PRESERVE ENABLE;

    简单实例.
    创建表 CREATE TABLE test(endtime DATETIME);

    创建存储过程test
         CREATE PROCEDURE test ()
         BEGIN
              update examinfo SET endtime = now() WHERE id = 14;
         END;

         创建event e_test
         CREATE EVENT if not exists e_test
              on schedule every 30 second
              on completion preserve
         do call test();
    CREATE EVENT if not exists e_test
              on schedule every 1 second
              on completion preserve
         do insert into aa values (now());
         每隔30秒将执行存储过程test,将当前时间更新到examinfo表中id=14的记录的endtime字段中去.

     

    触发器
    delimiter //
    CREATE TRIGGER trigger_htmlcache BEFORE INSERT ON t_model
      FOR EACH ROW BEGIN
        if CURDATE()<NEW.time then
        INSERT INTO t_htmlcache(id,url) value(NEW.id,NEW.url);
        end if;
    END;
    //
    通过建表->Insert的方式测试.

    DELIMITER $$
    DROP PROCEDURE IF EXISTS `njfyedepartment`.`sp_ireport` $$
    CREATE DEFINER=`root`@`%` PROCEDURE `sp_ireport`(IN qureyType VARCHAR(20),IN daytime VARCHAR(20),IN p_ids VARCHAR(50),IN c_ids VARCHAR(50),IN ct1_ids VARCHAR(50),IN ct2_ids VARCHAR(50),IN ku VARCHAR(50),IN ireport_chart varchar(50))
    BEGIN
    DECLARE i INT DEFAULT 1;
    IF qureyType  = 'insert' OR qureyType  = 'INSERT' THEN
    INSERT INTO ireport
    (pid,cid,ct1id,ct2id,creatTime,crawlerNumber,WEEK)
    SELECT province AS pid,
    cityid AS cid,
    category1id AS ct1id,
    category2id AS ct2id,
    (CURRENT_DATE) AS creatTime,COUNT(*) AS crawlerNumber,
    (FLOOR(DAYOFMONTH(CURRENT_DATE)/8)+1) AS WEEK
    FROM t_model t
    WHERE TIME > (CURRENT_DATE-1) AND TIME < (CURRENT_DATE)
    AND province IS NOT NULL
    AND cityid IS NOT NULL
    GROUP BY province,cityid,category1id,category2id;
    END IF;
    IF qureyType  = 'month' OR qureyType  = 'MONTH' THEN
    IF EXISTS(SELECT * FROM information_schema.`TABLES` T WHERE TABLE_NAME = 'tmp_result' AND TABLE_SCHEMA = ku) THEN
    DROP TABLE tmp_result;
    END IF;
    CREATE TABLE tmp_result
    (pid VARCHAR(50),pName VARCHAR(50),cid VARCHAR(50),cName VARCHAR(50),ct1id VARCHAR(50),ct1Name VARCHAR(50),
    ct2id VARCHAR(50),ct2Name VARCHAR(50),month1 INTEGER,month2 INTEGER,month3 INTEGER,month4 INTEGER,month5 INTEGER,
    month6 INTEGER,month7 INTEGER,month8 INTEGER,month9 INTEGER,month10 INTEGER,month11 INTEGER,month12 INTEGER,heji INTEGER);

    lable_exit: BEGIN
    SET @SqlCmd = ' INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name)
    SELECT pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name FROM
    (SELECT ia.pid,a.name AS pname,ia.cid,b.name AS cname,ia.ct1id,c.name AS ct1name,ia.ct2id,d.name AS ct2name
    FROM ireport ia
    LEFT JOIN province a ON ia.pid=a.id
    LEFT JOIN city b ON ia.cid=b.id
    LEFT JOIN t_category1 c ON ia.ct1id=c.id
    LEFT JOIN t_category2 d ON ia.ct2id=d.id
    WHERE YEAR(ia.creatTime)=YEAR(?) ';
    IF p_ids IS NOT NULL AND p_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.pid in (');
    SET @SqlCmd = CONCAT(@SqlCmd, p_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    IF c_ids IS NOT NULL AND c_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.cid in (');
    SET @SqlCmd = CONCAT(@SqlCmd, c_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    IF ct1_ids IS NOT NULL AND ct1_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct1id in (');
    SET @SqlCmd = CONCAT(@SqlCmd, ct1_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    IF ct2_ids IS NOT NULL AND ct2_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct2id in (');
    SET @SqlCmd = CONCAT(@SqlCmd, ct2_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    SET @SqlCmd = CONCAT(@SqlCmd , ') AS ir GROUP BY pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name;');
    PREPARE stmt1 FROM @SqlCmd;
    SET @a = daytime;
    EXECUTE stmt1 USING @a;
    DEALLOCATE PREPARE stmt1;
    LEAVE lable_exit;
    END lable_exit;

    WHILE i <= 12 DO
    lable_exit: BEGIN
    SET @SqlCmd = 'UPDATE tmp_result AS a,
    (
    SELECT pid,cid,ct1id,ct2id,SUM(crawlerNumber) AS crawlerNumber FROM
    (SELECT pid,cid,ct1id,ct2id,crawlerNumber FROM ireport WHERE MONTH(creatTime)=? AND YEAR(creatTime)=YEAR(?)) AS ir
    GROUP BY pid,cid,ct1id,ct2id
    ) AS b
    SET a.month';
    SET @SqlCmd = CONCAT(@SqlCmd , i);
    SET @SqlCmd = CONCAT(@SqlCmd , '=b.crawlerNumber ');
    SET @SqlCmd = CONCAT(@SqlCmd , 'WHERE a.pid=b.pid AND a.cid=b.cid AND a.ct1id=b.ct1id AND a.ct2id=b.ct2id; ');
    PREPARE stmt1 FROM @SqlCmd;
    SET @a = i;
    SET @b = daytime;
    EXECUTE stmt1 USING @a,@b;
    DEALLOCATE PREPARE stmt1;
    LEAVE lable_exit;
    END lable_exit;
    lable_exit: BEGIN
    SET @SqlCmd = 'UPDATE tmp_result SET month';
    SET @SqlCmd = CONCAT(@SqlCmd , i);
    SET @SqlCmd = CONCAT(@SqlCmd , ' = 0 WHERE month');
    SET @SqlCmd = CONCAT(@SqlCmd , i);
    SET @SqlCmd = CONCAT(@SqlCmd , ' IS NULL');
    PREPARE stmt1 FROM @SqlCmd;
    EXECUTE stmt1;
    DEALLOCATE PREPARE stmt1;
    LEAVE lable_exit;
    END lable_exit;
    SET i = i + 1;
    END WHILE;
    UPDATE tmp_result SET heji=month1+month2+month3+month4+month5+month6+month7+month8+month9+month10+month11+month12;

    INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12,heji)
    SELECT '' AS pid,'--' AS pname,'' AS cid,'总合计:' AS cname,'' AS ct1id,'--' AS ct1name,'' AS ct2id,'--' AS ct2name,SUM(month1) AS month1,SUM(month2) AS month2,SUM(month3) AS month3,SUM(month4) AS month4,
    SUM(month5) AS month5,SUM(month6) AS month6,SUM(month7) AS month7,SUM(month8) AS month8,SUM(month9) AS month9,SUM(month10) AS month10,SUM(month11) AS month11,SUM(month12) AS month12,SUM(heji) AS heji
    FROM tmp_result;

    IF ireport_chart  = 'report' OR ireport_chart  = 'REPORT' THEN
    SELECT pid,pName,cid,cName,ct1id,ct1Name,ct2id,ct2Name,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12,heji FROM tmp_result;
    END IF;
    IF ireport_chart  = 'chart' OR ireport_chart  = 'CHART' THEN
    SELECT '' AS pid,pName,'' AS cid,'' AS cName,'' AS ct1id,'' AS ct1Name,'' AS ct2id,'' AS ct2Name,SUM(month1) as month1,SUM(month2) as month2,SUM(month3) as month3,SUM(month4) as month4,
    SUM(month5) as month5,SUM(month6) as month6,SUM(month7) as month7,SUM(month8) as month8,SUM(month9) as month9,SUM(month10) as month10,SUM(month11) as month11,SUM(month12) as month12,'' AS heji
    FROM (SELECT pid,pName,cid,cName,ct1id,ct1Name,ct2id,ct2Name,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12 FROM tmp_result WHERE pname <> '--') AS ir
    GROUP BY pid;
    END IF;
    END IF;
    IF qureyType  = 'week' OR qureyType  = 'WEEK' THEN
    IF EXISTS(SELECT * FROM information_schema.`TABLES` T WHERE TABLE_NAME = 'tmp_result' AND TABLE_SCHEMA = ku) THEN
    DROP TABLE tmp_result;
    END IF;
    CREATE TABLE tmp_result
    (pid VARCHAR(50),pName VARCHAR(50),cid VARCHAR(50),cName VARCHAR(50),ct1id VARCHAR(50),ct1Name VARCHAR(50),ct2id VARCHAR(50),ct2Name VARCHAR(50),week1 INTEGER,week2 INTEGER,week3 INTEGER,week4 INTEGER,heji INTEGER);
    lable_exit: BEGIN
    SET @SqlCmd = ' INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name)
    SELECT pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name FROM
    (SELECT ia.pid,a.name AS pname,ia.cid,b.name AS cname,ia.ct1id,c.name AS ct1name,ia.ct2id,d.name AS ct2name
    FROM ireport ia
    LEFT JOIN province a ON ia.pid=a.id
    LEFT JOIN city b ON ia.cid=b.id
    LEFT JOIN t_category1 c ON ia.ct1id=c.id
    LEFT JOIN t_category2 d ON ia.ct2id=d.id
    WHERE YEAR(ia.creatTime)=YEAR(?) And MONTH(ia.creatTime)=MONTH(?) ';
    IF p_ids IS NOT NULL AND p_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.pid in (');
    SET @SqlCmd = CONCAT(@SqlCmd, p_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    IF c_ids IS NOT NULL AND c_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.cid in (');
    SET @SqlCmd = CONCAT(@SqlCmd, c_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    IF ct1_ids IS NOT NULL AND ct1_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct1id in (');
    SET @SqlCmd = CONCAT(@SqlCmd, ct1_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    IF ct2_ids IS NOT NULL AND ct2_ids <> '' THEN
    SET @SqlCmd = CONCAT(@SqlCmd , 'and ia.ct2id in (');
    SET @SqlCmd = CONCAT(@SqlCmd, ct2_ids);
    SET @SqlCmd = CONCAT(@SqlCmd, ')');
    END IF;
    SET @SqlCmd = CONCAT(@SqlCmd , ') AS ir GROUP BY pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name;');
    PREPARE stmt1 FROM @SqlCmd;
    SET @a = daytime;
    EXECUTE stmt1 USING @a,@a;
    DEALLOCATE PREPARE stmt1;
    LEAVE lable_exit;
    END lable_exit;

    WHILE i <= 4 DO
      lable_exit: BEGIN
    SET @SqlCmd = 'UPDATE tmp_result AS a,
    (
    SELECT pid,cid,ct1id,ct2id,SUM(crawlerNumber) AS crawlerNumber FROM
    (SELECT pid,cid,ct1id,ct2id,crawlerNumber FROM ireport WHERE WEEK=? AND MONTH(creatTime)=MONTH(?)) AS ir
    GROUP BY pid,cid,ct1id,ct2id
    ) AS b
    SET a.week';
    SET @SqlCmd = CONCAT(@SqlCmd , i);
    SET @SqlCmd = CONCAT(@SqlCmd , '=b.crawlerNumber ');
    SET @SqlCmd = CONCAT(@SqlCmd , 'WHERE a.pid=b.pid AND a.cid=b.cid AND a.ct1id=b.ct1id AND a.ct2id=b.ct2id; ');
    PREPARE stmt1 FROM @SqlCmd;
    SET @a = i;
    SET @b = daytime;
    EXECUTE stmt1 USING @a,@b;
    DEALLOCATE PREPARE stmt1;
    LEAVE lable_exit;
        END lable_exit;
      lable_exit: BEGIN
      SET @SqlCmd = 'UPDATE tmp_result SET week';
    SET @SqlCmd = CONCAT(@SqlCmd , i);
    SET @SqlCmd = CONCAT(@SqlCmd , ' = 0 WHERE week');
    SET @SqlCmd = CONCAT(@SqlCmd , i);
    SET @SqlCmd = CONCAT(@SqlCmd , ' IS NULL');
    PREPARE stmt1 FROM @SqlCmd;
    EXECUTE stmt1;
    DEALLOCATE PREPARE stmt1;
    LEAVE lable_exit;
      END lable_exit;
      SET i = i + 1;
    END WHILE;
    UPDATE tmp_result SET heji=week1+week2+week3+week4;

    INSERT INTO tmp_result (pid,pname,cid,cname,ct1id,ct1name,ct2id,ct2name,week1,week2,week3,week4,heji)
    SELECT '' AS pid,'--' AS pname,'' AS cid,'总合计:' AS cname,'' AS ct1id,'--' AS ct1name,'' AS ct2id,'--' AS ct2name, SUM(week1) AS week1,SUM(week2) AS week2,SUM(week3) AS week3,SUM(week4) AS week4,SUM(heji) AS heji
    FROM tmp_result;
    IF ireport_chart  = 'report' OR ireport_chart  = 'REPORT' THEN
    SELECT pid,pName,cid,cName,ct1id,ct1Name,ct2id,ct2Name,week1,week2,week3,week4,heji FROM tmp_result;
    END IF;
    IF ireport_chart  = 'chart' OR ireport_chart  = 'CHART' THEN
    SELECT '' as pid,pName,'' as cid,'' as cName,'' as ct1id,'' as ct1Name,'' as ct2id,'' as ct2Name,SUM(week1) AS week1,SUM(week2) AS week2,SUM(week3) AS week3,SUM(week4) AS week4,'' as heji
    FROM (SELECT pid,cid,pname,cname,week1,week2,week3,week4 FROM tmp_result WHERE pname <> '--') AS ir
    GROUP BY pid;
    END IF;
    END IF;
    END $$

    DELIMITER ;



    http://blog.csdn.net/magic_zj00/article/details/6932247

    展开全文
  • 记录一下 自用。不丢人,每天进步一点点。 服务器上的sql一直本机上裸奔+本地备份。...点完成 ok 执行sqlserver 中维护计划,触发该事件。查看备份日志 已存在。 再查看到异地备份的文件夹中,呦吼,也在
  • 今天在闲暇时间练习了一下oracle任务计划,具体详情如下1.创建表 TBL_TIMEcreatetabletbl_time( idnumbernotnull,/*id号*/ vsecondvarchar2(2),/*秒*/ vtimevarchar2(10)/*当前时间*/ )2.创建序列 seq_...
  • ---触发器语法Create Trigger [TriggerName] ON [TableName] FOR [Insert][,Delete][,Update]AS--触发器要执行的操作语句.Go---触发器例子 Create Trigger updatePoll---触发器名 On Poll --在Student表中创建...
  • MySQL 常用的查询脚本,包括查看视图 information_schema.views、存储过程/函数 information_schema.routines、触发器 information_schema.triggers、计划任务/事件 information_schema.events 以及对象依赖等信息。
  • Mysl计划任务、存储过程和触发器

    千次阅读 2014-12-09 14:01:42
    查看任务计划: SELECT * FROM mysql.event\G       更改计划任务 语法: ALTER EVENT [DEFINER = { user | CURRENT_USER }] #更改缺省用户 event_name [ON SCHEDULE schedule]...
  • 触发器

    2020-08-17 09:05:38
    触发器: 概念: 触发器是一种特殊类型的存储过程,在满足定义条件操作时触发,并自动执行触发器中预先设定好的定义的语句集合。 1、触发器是特殊的存储过程 ...4、提供了云星计划任务的另一种方式
  • 介绍如何通过 Oracle 数据字典查看视图、序列、存储过程/函数、程序包、触发器、同义词、计划任务以及对象之间的依赖关系等信息。
  • 打开Windows控制面板,找到“计划任务”,进去后,选择“创建基本任务”,第一步,为该任务命名;第二步,选择任务的执行时间,这里,我们选择“每天”,然后设置每天执行的开始时间;第三步,选择操作类型,我们...
  • MySQL触发器

    2020-03-25 13:53:10
    触发器的概念 触发器是和表关联的特殊的存储过程,可以在插入、删除...提供了运行计划任务的另一种方法 触发器的创建 触发器的四要素: 监控地点:TABLE 监控事件:INSERT、UPDATE、DELETE 触发时间:AFTER、BEFOR...
  • 计划任务 在mysql.exe客户端里写存储程序的";"分割符问题  这个问题来自mysql.exe客户端本身以";"作为语句的分隔符(结束符)本身。而大部分的管理、开发mysql的应用程序均类似于mysql.exe,所以必须通过...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 684
精华内容 273
关键字:

任务计划触发器