Home Forums Programming General Call sp from a Case statement RE: Call sp from a Case statement

  • Vitor da Fonseca - Monday, December 4, 2017 6:45 AM

    The SP delete all records from the table "Imart.ChurnRate" and then inserts information from two other different tables with these column names:

    BASE.SUBS_WEEK_AND_YEAR, DAY_ID, DATE, CHURN.BB_PACKAGE ,CHURN.DTH_CUSTOMER_TYPE, CURRWK, LASTWK, TOTAL_CHURN

    What I am trying to do is instead of guessing a time that the first two jobs are completed successfully, is to have a job which run the SQL to build the table Imart.ChurnRate.

    The first two jobs when they run, the column DW_CREATED_DATE is added with the date that it run, i.e. when they have run today the column will be populated for all records with today's date (04-12-2017), this also serves as a check, and off course if for any reason something went wrong I am able to run the query again for the date required.
    I hope that I've managed to explain, and please I apologise if my English is not the most correct...

    Thanks in advance,

    If its a Job, add a 3rd step to run the stored proc

    So the logic would be
    Step1 - Populate Base Table, on success go to next step, on failure quit report failure
    Step 2 - Populate BB_Churn, on success go to next, on failure quit report failure
    Step 3 - Execute sp_churnrate, on success quit report success, on failure quit report failure