Home Forums SQL Server 2005 Development Producing dates from SYSJOBS and SYSJOBHISTORY RE: Producing dates from SYSJOBS and SYSJOBHISTORY

  • Or you could just forget doing all the formatting yourself and use the msdb sys function dbo.agent_datetime(@date int no default,@time int no default)

    so to get the run date and time

    SELECT dbo.agent_datetime(run_date,run_time)

    or to get the completed date time

    SELECT DATEADD(s,DATEDIFF(s,dbo.agent_datetime(run_date,0),dbo.agent_datetime(run_date,run_duration)),dbo.agent_datetime(run_date,run_time))