automate a SQL query to run every month

2019-01-27 22:12发布

I have a simple SQL query that updates some date fields in a record, on a SQL Express instance.

I'd like to have it run automatically every month. What is the best way of accomplishing this in SQL Server 2005 Express using the Management Studio?

3条回答
地球回转人心会变
2楼-- · 2019-01-27 22:54

For SQL Server Express, there are a few possibilities. Unfortunately none of them involve Management Studio:

  1. Use a combination of Windows Scheduler, sqlcmd.exe, and .bat files
  2. Use SQL Server Service Broker
  3. Use a Codeplex variation of SQL Agent
  4. Use SQL Scheduler (free download)
查看更多
地球回转人心会变
3楼-- · 2019-01-27 22:54

you can make use of bat file to connect to your sql express using sqlcmd.exe and then set that bat file in windows scheduler to run it at desired time of interval.

查看更多
在下西门庆
4楼-- · 2019-01-27 22:55

Create a job with monthly schedule in Sql Agent and assign a T-Sql task to it with this query.

查看更多
登录 后发表回答