Subscribe

SQLServer-DBA.com Links

Subscribe to newsletter

Dba_db2_button

Powered by TypePad
SQL Agent Jobs – Schedule in seconds

16 January,2012 by Jack Vamvas

1)   How can I execute a SQL Server Agent Job every few seconds? Administrators try to use SQL Server Agent as a real-time scheduler  - and will attempt to exploit the in- build scheduler functionality.

2)  I wouldn’t recommend SQL Server Agent for sub-minute frequency scheduling. There are  better suited tools for this task. But , if SQL Server Agent is the only available option, use the stored procedures:

              msdb.dbo.sp_add_jobschedule or
              msdb.dbo.sp_update_jobschedule.

 The @freq_subday_type  is associated with msdb..sysjobschedules .

 The msdb..sysjobschedules  table allows the extra value of 0x2  (seconds).This example script updates a schedule to run every 15 seconds

 

GO
EXEC msdb.dbo.sp_update_schedule @schedule_id=4, 
		@freq_subday_interval=15,
            @freq_subday_type=2
GO

See Also

SQL Server agent fixed roles


Author: Jack Vamvas (http://www.sqlserver-dba.com)

******** *******

Subscribe to SQLServer-DBA.com

Latest posts delivered to you daily

Delivered by FeedBurner

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer