Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Job created by sp_add_jobschedule not running

Status
Not open for further replies.

bernie321

Programmer
Jan 7, 2004
477
GB
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

 
Have you selected View History for the job to see if the job ran?
 
I beleive that the job scheduler is only accurate to the minute not to the second.

I'm getting the same results on my system here.



Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top