Schedule Windows Service or Console App using Microsoft SQL JOB

What is a SQL JOB?

Let me explain, a JOB is a specified series of actions that an SQL server agent performs.

Use JOBs to define an administrative task and it can be run one or many as times and monitored either success or failure.

A SQL JOB can run on one local or multiple remote servers. That’s it.

NOW! Suppose we want to run a Windows application on a specific time interval.

Especially, There is one way to create a job scheduling using Quartz, and here I am going to introduce another way that is not commonly used using SQL Jobs.

Most Noteworthy, Here I am going to introduce one other way that is not well known among some .Net developers. This is by creating a schedule JOB in Microsoft SQL Server.

Here I am going to explain to you some steps for the run application using jobs. Follow the steps.

  1. Publish your Windows application or console application.
    SQL JOB
  2. Open Microsoft SQL server management studio navigate to SQL Server Agent and find Job.
  3. Right-click on Job Folder click on New Job and fill in general details.
    SQL JOB
  4. Now on left navigation on new job window click on steps and click on the New button at the bottom.
    SQL JOB
  5. The above steps will open a new window “New Job Step”, write the steps name, and select “Type: Operating system (CmdExec)”.
  6. Now in the command window copy the full path of the ex, you would like to execute and save this step. All the above 1-6 steps are responsible for defining which job to execute still, we have to define at what time/interval.
  7. Not to make it schedule click on “Schedules” in the New Job window under Steps and click on the New button.
    SQL JOB
  8. After clicking a new button it will open the New Job Schedule where the SQL server is full with a lot of options on which frequency you would like to run your application.

That’s all you have to follow only 8 easy steps and your schedule will start working with the SQL server.

There is one advantage of this kind of approach, NET server developers can easily call this job from stored procedure or code itself by executing the command:

exec msdb.dbo.sp_start_job N’youjobname’

I hope that this blog will help you. If you like my blog then you can share it on social with your friends.

Article by

Chintan Prajapati

Chintan Prajapati is the Founder and CEO of Satva Solutions and a seasoned computer engineer with over two decades of experience in the software industry. His expertise spans Accounting & ERP Integrations, Robotic Process Automation, and the development of technology solutions built around leading ERP and accounting platforms with a particular focus on responsible AI and machine learning in fintech.Chintan holds a BE in Computer Engineering and carries an impressive roster of certifications, including Microsoft Certified Professional, Microsoft Certified Technology Specialist, Certified Azure Solution Developer, Certified Intuit Developer, Certified QuickBooks ProAdvisor, and Xero Developer.Over the course of his career, he has made a measurable impact on the accounting industry consulting on and delivering integration and automation solutions that have collectively saved thousands of man-hours. His writing aims to offer readers practical, insight-driven advice on harnessing technology to unlock greater business efficiency.When he steps away from the desk, Chintan can be found trekking through mountain trails or watching birds in the wild. Grounded in the philosophy of delivering the highest value to clients, he continues to champion innovation and excellence in digital transformation from his home base in Ahmedabad, India.