• Welsh Corgi (3/31/2013)


    I'm trying to format the LAST_RUN_Date and the END_RUN_TIME in the Job history table but I'm not cutting it.

    I'm filtering on a specific job in this case.

    SELECTj.job_id,

    s.srvname,

    j.name,

    js.step_id,

    js.command,

    j.enabled ,

    last_run_date

    ,

    msdb.dbo.Agent_datetime(last_Run_Date, last_Run_Time) AS Run_Datetime

    --,

    -- Dateadd(second, Datediff(second, 0, msdb.dbo.Agent_datetime(19000101, last_Run_Duration)), msdb.dbo.Agent_datetime(last_Run_Date, last_Run_Time)) AS Run_Endtime

    --Stuff(Stuff(RIGHT('000000'+ Cast(last_Run_Duration AS VARCHAR(6)), 6), 5, 0, ':'), 3, 0, ':') AS run_duration

    FROMdbo.sysjobs j

    JOINdbo.sysjobsteps js

    ONjs.job_id = j.job_id

    JOINmaster.dbo.sysservers s

    ONs.srvid = j.originating_server_id

    WHERE j.name = 'Any Job Name'

    Any help would be greatly appreciated.

    Thanks.

    So, what is the problem?