I'm trying to force SQL Server to call a needed stored procedure each hour.
I've read the following articles:
- http://msdn.microsoft.com/en-us/library/ms190268.aspx
- http://msdn.microsoft.com/en-us/library/ms187320.aspx
They are quite big and not very straight forward.
Can anyone confirm that the following SQL code is right for my task:
USE msdb ;
GO
EXEC dbo.sp_add_job
@job_name = N'Exec RemoveOldCsvImportData' ;
GO
EXEC sp_add_jobstep
@job_name = N'Exec RemoveOldCsvImportData',
@step_name = N'execute stored procedure',
@subsystem = N'TSQL',
@command = N'exec RemoveOldCsvImportData',
@retry_attempts = 5,
@retry_interval = 5 ;
GO
EXEC dbo.sp_add_schedule
@schedule_name = N'RunOnce',
@freq_type = 4,
@freq_interval = 1,
@freq_subday_type = 0x8,
@freq_subday_interval = 1,
@active_start_time = 233000 ;
USE msdb ;
GO
EXEC sp_attach_schedule
@job_name = N'Exec RemoveOldCsvImportData',
@schedule_name = N'RunOnce';
GO
EXEC dbo.sp_add_jobserver
@job_name = N'Exec RemoveOldCsvImportData';
GO