Home Forums SQL Server 7,2000 T-SQL How to get output of SP_HELP_JOB into a script? RE: How to get output of SP_HELP_JOB into a script?

  • I was looking at this and although I've decided on the OPENROWSET method, I have got the table structure returned by sp_help_job if that helps anyone.

    CREATE TABLE #JobInfo(

    [job_id] [uniqueidentifier] NULL,

    [originating_server] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [name] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [enabled] [tinyint] NULL,

    [description] [nvarchar](512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [start_step_id] [int] NULL,

    [category] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [owner] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [notify_level_eventlog] [int] NULL,

    [notify_level_email] [int] NULL,

    [notify_level_netsend] [int] NULL,

    [notify_level_page] [int] NULL,

    [notify_email_operator] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [notify_netsend_operator] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [notify_page_operator] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [delete_level] [int] NULL,

    [date_created] [datetime] NULL,

    [date_modified] [datetime] NULL,

    [version_number] [int] NULL,

    [last_run_date] [int] NOT NULL,

    [last_run_time] [int] NOT NULL,

    [last_run_outcome] [int] NOT NULL,

    [next_run_date] [int] NOT NULL,

    [next_run_time] [int] NOT NULL,

    [next_run_schedule_id] [int] NOT NULL,

    [current_execution_status] [int] NOT NULL,

    [current_execution_step] [nvarchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [current_retry_attempt] [int] NOT NULL,

    [has_step] [int] NULL,

    [has_schedule] [int] NULL,

    [has_target] [int] NULL,

    [type] [int] NOT NULL

    )