Criar tarefas agendadas MSSQL

2
 Create a Schedule You can create a schedule for SQL Server Agent jobs in SQL Server 2014 by using SQL Server Management Studio, Transact-SQL, or SQL Server Management Objects. Before you begin: Security To create a schedule, using: SQL Server Management Studio Transact-SQL SQL Server Management Objects Before You Begin Security For detailed information, see Implement SQL Server Agent Security.  [Top] Using SQL Server Management Studio To create a schedule In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance. 1. Expand SQL Server Agent, right-click Jobs, and select Manage Schedules. 2. In the Manage Schedules dialog box, click New. 3. In the Name box, type a name for the new schedule. 4. If you do not want the schedule to take effect immediately after it has been created, clear the Enabled check box. 5. 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. 6.  [Top] Using Transact-SQL SQL Server 2014 1 out of 1 rated this helpful Create a Schedule http://msdn.microsoft.com/en-us/library/cc645912.aspx 1 of 2 20/08/2014 17:16

description

Criar tarefas agendadas MSSQL

Transcript of Criar tarefas agendadas MSSQL

  • Create a Schedule

    You can create a schedule for SQL Server Agent jobs in SQL Server 2014 by using SQL Server Management Studio,

    Transact-SQL, or SQL Server Management Objects.

    Before you begin:

    Security

    To create a schedule, using:

    SQL Server Management Studio

    Transact-SQL

    SQL Server Management Objects

    Before You Begin

    Security

    For detailed information, see Implement SQL Server Agent Security.

    [Top]

    Using SQL Server Management Studio

    To create a schedule

    In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.1.

    Expand SQL Server Agent, right-click Jobs, and select Manage Schedules.2.

    In the Manage Schedules dialog box, click New.3.

    In the Name box, type a name for the new schedule.4.

    If you do not want the schedule to take effect immediately after it has been created, clear the Enabled check box.5.

    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.

    6.

    [Top]

    Using Transact-SQL

    SQL Server 2014 1 out of 1 rated this helpful

    Create a Schedule http://msdn.microsoft.com/en-us/library/cc645912.aspx

    1 of 2 20/08/2014 17:16

  • Community Additions

    To create a schedule

    In Object Explorer, connect to an instance of Database Engine.1.

    On the Standard bar, click New Query.2.

    Copy and paste the following example into the query window and click Execute.3.

    For more information, see sp_add_schedule (Transact-SQL).

    [Top]

    Using SQL Server Management Objects

    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).

    [Top]

    2014 Microsoft

    -- 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

    Create a Schedule http://msdn.microsoft.com/en-us/library/cc645912.aspx

    2 of 2 20/08/2014 17:16