自动执行每月运行的SQL查询

时间:2022-09-24 01:08:17

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

我有一个简单的SQL查询,它在SQL Express实例上更新记录中的某些日期字段。

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?

我想让它每月自动运行。使用Management Studio在SQL Server 2005 Express中实现此目的的最佳方法是什么?

3 个解决方案

#1


12  

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

对于SQL Server Express,有一些可能性。不幸的是,它们都没有涉及Management Studio:

  1. Use a combination of Windows Scheduler, sqlcmd.exe, and .bat files
  2. 使用Windows Scheduler,sqlcmd.exe和.bat文件的组合
  3. Use SQL Server Service Broker
  4. 使用SQL Server Service Broker
  5. Use a Codeplex variation of SQL Agent
  6. 使用SQL Agent的Codeplex变体
  7. Use SQL Scheduler (free download)
  8. 使用SQL Scheduler(免费下载)

#2


0  

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

在Sql Agent中创建具有月度计划的作业,并使用此查询为其分配T-Sql任务。

#3


0  

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.

您可以使用bat文件使用sqlcmd.exe连接到您的sql express,然后在Windows调度程序中设置该bat文件以在所需的间隔时间运行它。

#1


12  

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

对于SQL Server Express,有一些可能性。不幸的是,它们都没有涉及Management Studio:

  1. Use a combination of Windows Scheduler, sqlcmd.exe, and .bat files
  2. 使用Windows Scheduler,sqlcmd.exe和.bat文件的组合
  3. Use SQL Server Service Broker
  4. 使用SQL Server Service Broker
  5. Use a Codeplex variation of SQL Agent
  6. 使用SQL Agent的Codeplex变体
  7. Use SQL Scheduler (free download)
  8. 使用SQL Scheduler(免费下载)

#2


0  

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

在Sql Agent中创建具有月度计划的作业,并使用此查询为其分配T-Sql任务。

#3


0  

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.

您可以使用bat文件使用sqlcmd.exe连接到您的sql express,然后在Windows调度程序中设置该bat文件以在所需的间隔时间运行它。