Send email when a record is missing

  • Hi

    I have a table
    CREATE TABLE tableName(id int primarykey, ProcessName varchar(50) null, IncomeDate datetime null, isProcessed int)
    INSERT INTO tableName(id,ProcessName,IncomeDate,isProcessed)
    VALUES (1,'Process1','2017-10-01',1),(1,'Process1','2017-10-02',1),(1,'Process1','2017-10-04',1),(1,'Process1','2017-10-05',1),
     (1,'Process2','2017-10-01',1),(1,'Process2','2017-10-03',1),(1,'Process2','2017-10-05',1),
    (1,'Process3','2017-10-02',1),(1,'Process3','2017-10-03',1),(1,'Process3','2017-10-04',1),(1,'Process3','2017-10-05',1)

    This table was populated on the 1st to the 5th. These process has to be populated daily, but there are days where they were not loaded. What I want to achive is to have a process to check if certain file are missing, then send email that "The 'Process1' file was not loaded.

    Please help with a logic construction or even a better logic.

  • hoseam - Tuesday, October 31, 2017 6:23 AM

    Hi

    I have a table
    CREATE TABLE tableName(id int primarykey, ProcessName varchar(50) null, IncomeDate datetime null, isProcessed int)
    INSERT INTO tableName(id,ProcessName,IncomeDate,isProcessed)
    VALUES (1,'Process1','2017-10-01',1),(1,'Process1','2017-10-02',1),(1,'Process1','2017-10-04',1),(1,'Process1','2017-10-05',1),
     (1,'Process2','2017-10-01',1),(1,'Process2','2017-10-03',1),(1,'Process2','2017-10-05',1),
    (1,'Process3','2017-10-02',1),(1,'Process3','2017-10-03',1),(1,'Process3','2017-10-04',1),(1,'Process3','2017-10-05',1)

    This table was populated on the 1st to the 5th. These process has to be populated daily, but there are days where they were not loaded. What I want to achive is to have a process to check if certain file are missing, then send email that "The 'Process1' file was not loaded.

    Please help with a logic construction or even a better logic.

    So ... is this a process which runs every day and, if there are no files for that day, sends an e-mail?
    Isn't that what this post is all about? Why have you posted again?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • My first question would be, why would the process not load for a particular day?  If the load process throws an error, include the logic to send your e-mail in that process.  If it's because there's no file to load, again, have the loading procedure handle sending the message.

    If it's because some user needs to perform a manual process to load the data, and they called in on the 3rd so "Process1" didn't get run, automate the process instead, remove as much of the human element as possible.

  • Phil Parkin - Tuesday, October 31, 2017 6:31 AM

    hoseam - Tuesday, October 31, 2017 6:23 AM

    Hi

    I have a table
    CREATE TABLE tableName(id int primarykey, ProcessName varchar(50) null, IncomeDate datetime null, isProcessed int)
    INSERT INTO tableName(id,ProcessName,IncomeDate,isProcessed)
    VALUES (1,'Process1','2017-10-01',1),(1,'Process1','2017-10-02',1),(1,'Process1','2017-10-04',1),(1,'Process1','2017-10-05',1),
     (1,'Process2','2017-10-01',1),(1,'Process2','2017-10-03',1),(1,'Process2','2017-10-05',1),
    (1,'Process3','2017-10-02',1),(1,'Process3','2017-10-03',1),(1,'Process3','2017-10-04',1),(1,'Process3','2017-10-05',1)

    This table was populated on the 1st to the 5th. These process has to be populated daily, but there are days where they were not loaded. What I want to achive is to have a process to check if certain file are missing, then send email that "The 'Process1' file was not loaded.

    Please help with a logic construction or even a better logic.

    So ... is this a process which runs every day and, if there are no files for that day, sends an e-mail?
    Isn't that what this post is all about? Why have you posted again?

    Yes.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply