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:
with ld as (
EXEC_DESCRIPTOR as EXECUTION,
DATEDIFF(mi,INITIALIZE_TIME,END_TIME) as StartToEnd_Mins,
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
LOAD DISTINCT Rec
,if(IsNull(Rec) OR Date(Rec) <> Date(Today()),1,0) as Fail
LET vFail = PEEK('Fail','VAL');
Here is where I would put the Sleep and reload function.