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

  • BitWise MnM (3/25/2012)


    thanks, probably the best working code dealing with the subject. I replaced the datetime with time(0), just easier on my eyes:

    CAST(STUFF(STUFF(REPLACE(STR(run_time, 6), ' ', '0'), 3, 0, ':'), 6, 0, ':') AS time(0)) AS runtime,

    CAST(STUFF(STUFF(REPLACE(STR(run_duration, 6), ' ', '0'), 3, 0, ':'), 6, 0, ':') AS time(0)) AS duration

    It's probably worth mentioning that TIME(0) was added to T-SQL in SQL Server 2008.