Create SQL Job – Stored Procedure

 

Hey Friends,

Sometimes a situation comes were NAV Job stops and we keep on debugging but yet unable to stump the real cause. Even after continuously tracing in Event Viewer we dint found any solid reason for this. So to solve my scenario I decided to write a SP(Stored Procedure) which eventually I attached it as a SQL Job which is supposed to be one of the best scheduler in Programming World.

So here I am to just share with all you as How to Make a SQL Job. 

Login to your SQL Management Studio. In Object explorer you will find SQL SERVER AGENT. Make sure you have a level of Permission in SQL otherwise you wont be able to see this. Right Click on Job and make a new Job.

1

Now you will be able to see a separate Page – Here you have to fill some Information as Name of your JOB, Owner(By Default it will be yours) etc. – Make it enabled as shown in the below Screenshot.

Capture

Now you have to click on Steps – Here you need to fill some mandatory information as Database Name, Command – Procedure Name.

This EXEC command is going to execute your Procedure on regular Intervals.

Capture1

You may click on Advanced on the left Panel and make your Job some more conditional based as what you want to do on Success or on failure of the Job.

Capture2

Now you need to navigate to Schedule menu(Second Screenshot). This is the place where you need to define what will be the recurring timing your Job OR at what intervals or conditions you need to execute your Job.

Capture3

Now you may navigate to Alert menu if you want to make your Job a level more customized. Here you can define Job to raise an alert if the message contains some specific value. If not needed you can skip this. I dint mentioned this in my Job.

Capture4

Now there is a separate menu for notification which you can use use for mail transmissions if Job fails with additional more services.

Capture5

Now simply press OK. Open the first Screenshot page and press View History. Here you can see the logs of your running Job.

CHEERS.

2 comments on “Create SQL Job – Stored Procedure

  1. Pingback: Create SQL Job – Stored Procedure - Microsoft Dynamics NAV Community

  2. Pingback: Create SQL Job – Stored Procedure - Dynamics NAV by RockWithNAV - Dynamics NAV Users

Leave a comment