| title | Create a Schedule | ||||
|---|---|---|---|---|---|
| ms.custom | seo-lt-2019 | ||||
| ms.date | 01/19/2017 | ||||
| ms.prod | sql | ||||
| ms.prod_service | sql-tools | ||||
| ms.technology | ssms | ||||
| ms.topic | conceptual | ||||
| helpviewer_keywords |
|
||||
| ms.assetid | 8c7ef3b3-c06d-4a27-802d-ed329dc86ef3 | ||||
| author | markingmyname | ||||
| ms.author | maghan | ||||
| ms.manager | jroth | ||||
| ms.reviewer | |||||
| monikerRange | = azuresqldb-mi-current || >= sql-server-2016 || = sqlallproducts-allversions |
[!INCLUDEappliesto-ss-asdbmi-xxxx-xxx-md]
Important
On Azure SQL Database Managed Instance, most, but not all SQL Server Agent features are currently supported. See Azure SQL Database Managed Instance T-SQL differences from SQL Server for details.
You can create a schedule for [!INCLUDEssNoVersion] Agent jobs in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull], [!INCLUDEtsql], or SQL Server Management Objects.
-
Before you begin:
-
To create a schedule, using:
For detailed information, see Implement SQL Server Agent Security.
-
In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and then expand that instance.
-
Expand SQL Server Agent, right-click Jobs, and select Manage Schedules.
-
In the Manage Schedules dialog box, click New.
-
In the Name box, type a name for the new schedule.
-
If you do not want the schedule to take effect immediately after it has been created, clear the Enabled check box.
-
For Schedule Type, select one of the following:
-
To start the job when the CPUs reach an idle condition, click Start whenever the CPUs become idle.
-
If you want a schedule to run repeatedly, click Recurring. To set the recurring schedule, complete the Frequency, Daily Frequency, and Duration groups on the dialog.
-
If you want the schedule to run only one time, click One time. To set the One time schedule, complete the One-time occurrence group on the dialog box.
-
-
In Object Explorer, connect to an instance of [!INCLUDEssDE].
-
On the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute.
-- creates a schedule named RunOnce. -- The schedule runs one time, at 23:30 on the day that the schedule is created. USE msdb ; GO EXEC dbo.sp_add_schedule @schedule_name = N'RunOnce', @freq_type = 1, @active_start_time = 233000 ; GO
For more information, see sp_add_schedule (Transact-SQL).
To create a schedule
Use the JobSchedule class by using a programming language that you choose, such as Visual Basic, Visual C#, or PowerShell. For more information, see SQL Server Management Objects (SMO).