• Lawrence-136504 (3/18/2010)


    I re-copied the logic and then pasted it into ssms (query window) and removed some hidden characters and I'm getting below error now.

    EXEC [master].dbo.xp_sqlagent_enum_jobs 1, 'DomainName\lawrence', 'B508F33F-8C69-42B9-9635-4CA66C05548D'

    Msg 241, Level 16, State 1, Line 56

    Conversion failed when converting date and/or time from character string.

    Looks like it's bombing out on the DATEDIFF logic. Thoughts.

    Thanks, I was getting the same thing with the weird chars.

    Looks like the problem with my DATEDIFF logic is that it assumes a recurrence of the job (with a non-recurring job the date is stored as 0 by SQL Server). My code looks at the last time the job would have run from the schedule and finds the difference between then and GETDATE() to come up with an answer.

    Is that the case with the job you're looking at?

    MJM