Home All Groups Group Topic Archive Search About

HELP!!! --- From Job tasks to ASP

Author
19 Mar 2007 3:26 PM
segis bata
Hello everyone,

Is it possible (and if so, how?) to export the list job tasks (with status,
last run, etc.) from SQL Server to a table (in the same SQL Server) so I can
create a simple ASP file showing the results?

Also, that export process should be running periodically because I don't
want just a snapshot of sometime in the past but a recurrent display of the
tasks in SQL with their particular information.

FYI, I'm running SQL Server 2000 in a Win2003 SP1 box

Thanks in advance for all your help...
SB-R

Author
19 Mar 2007 3:38 PM
Steen_Schlüter_Persson_(DK)
segis bata wrote:
Show quote
> Hello everyone,
>
> Is it possible (and if so, how?) to export the list job tasks (with status,
> last run, etc.) from SQL Server to a table (in the same SQL Server) so I can
> create a simple ASP file showing the results?
>
> Also, that export process should be running periodically because I don't
> want just a snapshot of sometime in the past but a recurrent display of the
> tasks in SQL with their particular information.
>
> FYI, I'm running SQL Server 2000 in a Win2003 SP1 box
>
> Thanks in advance for all your help...
> SB-R
>
>
Hi,

Try to take a look at sysjobhistory table in the MSDB database. That
should get you started.

  --
Regards
Steen Schlüter Persson
Database Administrator / System Administrator
Author
19 Mar 2007 3:44 PM
Immy
Why reinvent the wheel?
Just query the tables directly via a stored procedure and call the procedure
when requiring an update?


Show quote
"segis bata" <segisb***@hotmail.com> wrote in message
news:eF%23AVrjaHHA.2448@TK2MSFTNGP02.phx.gbl...
> Hello everyone,
>
> Is it possible (and if so, how?) to export the list job tasks (with
> status, last run, etc.) from SQL Server to a table (in the same SQL
> Server) so I can create a simple ASP file showing the results?
>
> Also, that export process should be running periodically because I don't
> want just a snapshot of sometime in the past but a recurrent display of
> the tasks in SQL with their particular information.
>
> FYI, I'm running SQL Server 2000 in a Win2003 SP1 box
>
> Thanks in advance for all your help...
> SB-R
>
Author
19 Mar 2007 3:45 PM
Immy
Helps if I add the tables for you too! :)

look at msdb..sysjobhistory and msdb..sysjobs

Immy

Show quote
"segis bata" <segisb***@hotmail.com> wrote in message
news:eF%23AVrjaHHA.2448@TK2MSFTNGP02.phx.gbl...
> Hello everyone,
>
> Is it possible (and if so, how?) to export the list job tasks (with
> status, last run, etc.) from SQL Server to a table (in the same SQL
> Server) so I can create a simple ASP file showing the results?
>
> Also, that export process should be running periodically because I don't
> want just a snapshot of sometime in the past but a recurrent display of
> the tasks in SQL with their particular information.
>
> FYI, I'm running SQL Server 2000 in a Win2003 SP1 box
>
> Thanks in advance for all your help...
> SB-R
>
Author
19 Mar 2007 4:00 PM
segis bata
Hello,

Thanks for the info, but I can't see sysjobhistory and sysjobs tables in
MSDB (I only see sysjobs_view)

SB-R



Show quote
"Immy" <therealasianb***@hotmail.com> wrote in message
news:u2QC12jaHHA.1244@TK2MSFTNGP04.phx.gbl...
> Helps if I add the tables for you too! :)
>
> look at msdb..sysjobhistory and msdb..sysjobs
>
> Immy
>
> "segis bata" <segisb***@hotmail.com> wrote in message
> news:eF%23AVrjaHHA.2448@TK2MSFTNGP02.phx.gbl...
>> Hello everyone,
>>
>> Is it possible (and if so, how?) to export the list job tasks (with
>> status, last run, etc.) from SQL Server to a table (in the same SQL
>> Server) so I can create a simple ASP file showing the results?
>>
>> Also, that export process should be running periodically because I don't
>> want just a snapshot of sometime in the past but a recurrent display of
>> the tasks in SQL with their particular information.
>>
>> FYI, I'm running SQL Server 2000 in a Win2003 SP1 box
>>
>> Thanks in advance for all your help...
>> SB-R
>>
>
>
Author
19 Mar 2007 4:07 PM
segis bata
Sorry,

I was looking at the views instead of the tables

Thanks again!

SB-R


Show quote
"segis bata" <segisb***@hotmail.com> wrote in message
news:eZGgw%23jaHHA.4000@TK2MSFTNGP02.phx.gbl...
> Hello,
>
> Thanks for the info, but I can't see sysjobhistory and sysjobs tables in
> MSDB (I only see sysjobs_view)
>
> SB-R
>
>
>
> "Immy" <therealasianb***@hotmail.com> wrote in message
> news:u2QC12jaHHA.1244@TK2MSFTNGP04.phx.gbl...
>> Helps if I add the tables for you too! :)
>>
>> look at msdb..sysjobhistory and msdb..sysjobs
>>
>> Immy
>>
>> "segis bata" <segisb***@hotmail.com> wrote in message
>> news:eF%23AVrjaHHA.2448@TK2MSFTNGP02.phx.gbl...
>>> Hello everyone,
>>>
>>> Is it possible (and if so, how?) to export the list job tasks (with
>>> status, last run, etc.) from SQL Server to a table (in the same SQL
>>> Server) so I can create a simple ASP file showing the results?
>>>
>>> Also, that export process should be running periodically because I don't
>>> want just a snapshot of sometime in the past but a recurrent display of
>>> the tasks in SQL with their particular information.
>>>
>>> FYI, I'm running SQL Server 2000 in a Win2003 SP1 box
>>>
>>> Thanks in advance for all your help...
>>> SB-R
>>>
>>
>>
>
>
Author
19 Mar 2007 4:25 PM
Paul Ibison
Pls have a look in the system tables folder for dbo.sysjobhistory.

For a more immediate view of job states you can use this code:

CREATE TABLE #xp_results (job_id UNIQUEIDENTIFIER NOT NULL,

last_run_date INT NOT NULL,

last_run_time INT NOT NULL,

next_run_date INT NOT NULL,

next_run_time INT NOT NULL,

next_run_schedule_id INT NOT NULL,

requested_to_run INT NOT NULL, -- BOOL

request_source INT NOT NULL,

request_source_id sysname collate database_default

null,

running INT NOT NULL, -- BOOL

current_step INT NOT NULL,

current_retry_attempt INT NOT NULL,

job_state INT NOT NULL) -- 1 = Executing, 2 = Waiting For Thread, 3 =
Between Retries, 4 = Idle, 5 = Suspended, 6 = [obsolete], 7 =
PerformingCompletionActions

INSERT INTO #xp_results

EXECUTE master.dbo.xp_sqlagent_enum_jobs 1, 'dbo'

SELECT sysjobs_view.name, #xp_results.* FROM #xp_results inner join
msdb.dbo.sysjobs_view sysjobs_view

on #xp_results.job_id = sysjobs_view.job_id

DROP TABLE #xp_results



Rgds,

Paul Ibison

AddThis Social Bookmark Button