Hi
I am using this code to schedule a job to execute in 5 seconds.
It creates the schedule. If I switch to the Job in enterprise manager
before the 5 secs are up: it is marked enabled. If I switch to the job 5
seconds later it is marked disabled.
But the job has not run.
If I manually run the job in enterprise manager it runs correctly
DECLARE @StartDate INT
DECLARE @StartTime INT
DECLARE @ScheduleName VARCHAR(255)
SELECT @ScheduleName = Convert(VarChar(55), GetDate(), 113)
SELECT @StartTime = CONVERT(INT, REPLACE(CONVERT(VarChar(8), DateAdd(SS, 5,
GetDate()), 114), ':', ''))
SELECT @StartDate = CONVERT(INT,convert(varchar(8), getdate(), 112))
EXEC msdb.dbo.sp_add_jobschedule @job_name = 'Mark Cleared', @name =
@ScheduleName, @freq_type = 1, @freq_interval = 1, @active_start_date =
@StartDate, @active_start_time = @StartTime
Any help would be much appreciated.
Thanks
B
I am using this code to schedule a job to execute in 5 seconds.
It creates the schedule. If I switch to the Job in enterprise manager
before the 5 secs are up: it is marked enabled. If I switch to the job 5
seconds later it is marked disabled.
But the job has not run.
If I manually run the job in enterprise manager it runs correctly
DECLARE @StartDate INT
DECLARE @StartTime INT
DECLARE @ScheduleName VARCHAR(255)
SELECT @ScheduleName = Convert(VarChar(55), GetDate(), 113)
SELECT @StartTime = CONVERT(INT, REPLACE(CONVERT(VarChar(8), DateAdd(SS, 5,
GetDate()), 114), ':', ''))
SELECT @StartDate = CONVERT(INT,convert(varchar(8), getdate(), 112))
EXEC msdb.dbo.sp_add_jobschedule @job_name = 'Mark Cleared', @name =
@ScheduleName, @freq_type = 1, @freq_interval = 1, @active_start_date =
@StartDate, @active_start_time = @StartTime
Any help would be much appreciated.
Thanks
B