|I have created a step 1 in the SQL Agent Job:
DECLARE @LastDayOfYear Date, @GetHour INT , @NextNewDate DateTime
SET @LastDayOfYear = DATEADD(yy, DATEDIFF(yy,0,GETDATE()) + 1, -1)
SET @GetHour = datepart(hour, GETDATE()) -- returns hour
--Get Today date to compare to the last day of December in current year
IF (FORMAT(GETDATE(), 'yyyy-MM-dd') = FORMAT('2014-05-28', 'yyyy-MM-dd')) AND (@GetHour >=15)
EXEC msdb.dbo.sp_stop_job @job_name='Testjob'
Then created step 2 to call the stored procedure I have created
I then created a scheduler to test it out with today date starting from 11am and every 5 mins with recurring mode.
For some reason, it nevers call the stored proc which should have from step 1 to step 2
Any ideas please?