• I'm going to take a quick stab at this since nobody has responded yet. What I am showing you here is not a complete solution but should get you moving in the right direction.

    First, msdb.dbo.sp_help_jobactivity should give you a number of columns: the query below runs fine for me on 2008 and 2012.

    DECLARE @job_hist TABLE

    (session_idint,

    job_id varchar(100),

    job_name varchar(200),

    run_requested_date datetime,

    run_requested_source int,

    queued_datedatetime,

    start_execution_date datetime,

    last_executed_step_id int,

    last_executed_step_datedatetime,

    stop_execution_date datetime,

    next_scheduled_run_date datetime,

    job_history_id bigint,

    [message] varchar(1000),

    run_status int,

    operator_id_emailedint,

    operator_id_netsentint,

    operator_id_paged int)

    INSERT @job_hist

    EXEC msdb.dbo.sp_help_jobactivity

    SELECT 'Scheduled' AS Scheduled_or_manual,

    PATINDEX('%The Job was invoked by Schedule%',[message]),

    *

    FROM @job_hist

    WHERE PATINDEX('%The Job was invoked by Schedule%',[message])<>0

    UNION ALL

    SELECT 'Manual',

    PATINDEX('%The Job was invoked by user%',[message]),

    *

    FROM @job_hist

    WHERE PATINDEX('%The Job was invoked by user%',[message])<>0

    That said, you can also get this information from msdb..sysjobhistory

    SELECT 'manual' AS Scheduled_or_manual, *

    FROM msdb..sysjobhistory

    WHERE step_id=0

    AND PATINDEX('%The Job was invoked by user%',[message])<>0

    UNION

    SELECT 'scheduled' AS Scheduled_or_manual, *

    FROM msdb..sysjobhistory

    WHERE step_id=0

    AND PATINDEX('%The Job was invoked by schedule%',[message])<>0

    AGAIN: Both the above queries are not complete solutions but should get you started.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001