Srihari
Srihari

Reputation: 2519

How to get the start time of an SQL process?

A job running on our SQL server failed. We are running MS SQL server 2005. While investigating, the following question came up: When was this process initiated on the server? Is there any query I can run that will give me this information?

Upvotes: 1

Views: 5047

Answers (3)

Raj More
Raj More

Reputation: 48018

This should give you what you need

SELECT 
    Jobs.name, 
    StartTime = CONVERT 
        ( 
            DATETIME, 
            RTRIM(run_date) 
            ) 
            +  
            ( 
            run_time * 9 
            + run_time % 10000 * 6 
            + run_time % 100 * 10 
        ) / 216e4 
    ,
    endTime = CONVERT 
        ( 
            DATETIME, 
            RTRIM(run_date) 
            ) 
            +  
            ( 
            run_time * 9 
            + run_time % 10000 * 6 
            + run_time % 100 * 10 
            + 25 * run_duration 
        ) / 216e4 
FROM 
    msdb..sysjobhistory JobHistory 
    INNER JOIN msdb..sysjobs Jobs 
        ON Jobs.job_id = JobHistory.job_id 
WHERE 
JobHistory.step_name = '(Job outcome)'

Upvotes: 3

DForck42
DForck42

Reputation: 20327

using management studios, you can right click the job and click view history. this will containt the list of executions for the job.

Upvotes: 0

BIDeveloper
BIDeveloper

Reputation: 2638

USE msdb SELECT * FROM dbo.sysjobs_view

Upvotes: 0

Related Questions