5. Scheduling daily and monthly job


Creating daily and monthly job

AGR Daily job

  1. Open SQL Server Agend and right click the Jobs folder and select “New Job…” create
  2. General tab: fill out the name and owner.
    • Name: “AGR5-Daily”
    • The owner is the user that has the rights to run jobs. create
  3. Steps tab: select New
    • In the General tab you fill out Step name, Database and Command
      • Step name: “All daily run”
      • The database should be the staging database.
      • In the command type “EXEC [job].[all_daily_run]" create
      • In the Advanced tab make sure to choose the appriopriate action in *“On success action”
        • If this is the last step (or only step) in the daily job, choose *“Quit the job reporting success”.
        • If you will be adding another step, choose “Go to the next step” create
  4. Finally, you go the Schedule tab and choose New to set appopriate schedule
    • First name the schedule e.g. “Daily
    • The timing depends on the setup. The ERP data needs to be ready and the transfer needs to be finished in the morning.

AGR Monthly job

  1. Create new job in the same way as when creating the daily job.
  2. Under the General tab you fill out the name and the owner
    • Step name: “AGR5 - Monthly”
    • The owner is the user that has the rights to run jobs.
  3. Go into Steps tab and add new step by clicking New
    • In the General tab fill out Step name, Database
      • Step name: “Forecast - load locations”
      • The database: agr5_stg
      • Command: “EXEC [job].[run_forecasts_load_locations]”. This is a procedure that creates a trigger by inserting all locations from the rep.locations table into a table named ctr.location_for_forecasting. If there are locations in this table, the forecast will be run for those locations in the daily job (as can be seen in the procedure job.all_daily_run).
  4. Go to the Schedule tab and choose New to set the appropriate schedule.
    • Name: “Monthly”
    • The default is to run the monthly job on the first Saturday of every month, around midnight. However if the customer has other preferences then you set it according to that.