SQLTeam.com | Weblogs | Forums

Need to run Query every day at 12:00 AM, No SQL server Agent

Hi Team.

I have SQL server management studio 18, I need to run two jobs, one which runs every day at 12:00 AM and another which runs every Friday at 01:00 AM. I did not find an SQL server Agent in my machine to create SQL jobs. Can anyone help me doing in any other way? Please let me know the steps.

Which edition of SQL Server do you have? You can run SELECT @@VERSION to find out if you're not sure.

If you're running Express, or just otherwise can't use SQL Agent, you can use the Windows Task Scheduler to run SQL scripts with the SQLCMD utility:

  1. Save the SQL statements you want to run in a script, e.g. Daily.sql
  2. Run Notepad, and save the following text as Daily.bat: sqlcmd -S servername -i Daily.sql
  3. Run Task Scheduler, create a basic task, make Daily.bat the action, and set your schedule as the trigger

Thanks for the reply Robert,

The version details are: Microsoft SQL Azure (RTM) - 12.0.2000.8 Apr 29 2021 13:52:20 Copyright (C) 2019 Microsoft Corporation. I am trying to implement your steps. If there is a better way, Please let me know.

Ahhh, you're using Azure SQL, then you'll need to work with Azure Automation, using a runbook, or with Elastic Jobs:

Suggest using Elastic jobs, if all you need to do is run T-SQL. Azure Automation would use PowerShell most likely, and may be overkill.

1 Like

Thanks Robert,

I am exploring Elastic jobs for this. I will implement it accordingly.