4 Replies Latest reply: Oct 12, 2017 1:50 PM by Massimo Grossi RSS

    Sleep for 5 minutes then restart load script

    Andrew Moberg

      Hello

       

      I have a load script that does a date check for last update time of a table. If that update time is NULL or the update time is not today then set variable to 1 else 0. How do script if the variable is 1 Sleep for 5 minutes then restart the load script. Here is the load statement I am using:

       

      CHK:

      LOAD Rec;

      SQL

      with ld as (

      select TABLE_NAME, 

      DEPENDENT_INI,

      EXEC_DESCRIPTOR as EXECUTION,

      INITIALIZE_TIME,

      END_TIME,

      DATEDIFF(mi,INITIALIZE_TIME,END_TIME) as StartToEnd_Mins,

      ROWS_INITLY_LOADED,

      ROWS_STAGED,

      STATUS

      from CR_STAT_EXTRACT

      where STATUS in ('Success', 'Warning') --Only show loaded tables

      and LOAD_POOL is not NULL

      and CONVERT(date,INITIALIZE_TIME) = CONVERT(date,GetDate())

      and DEPENDENT_INI NOT LIKE 'VR_%'

      --and TABLE_NAME = 'ARPB_TRANSACTIONS'

      )

      SELECT MAX(CONVERT(date,END_TIME)) as Rec

      FROM ld;

       

       

      VAL:

      LOAD DISTINCT Rec

      ,if(IsNull(Rec) OR Date(Rec) <> Date(Today()),1,0) as Fail

      RESIDENT CHK;

       

       

      LET vFail = PEEK('Fail','VAL');

       

      Here is where I would put the Sleep and reload function.

       

      Any help would be greatly appreciated.

       

      Thanks