dbTalk Databases Forums  

Check if scheduled job has ended

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Check if scheduled job has ended in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ray
 
Posts: n/a

Default Check if scheduled job has ended - 10-20-2003 , 01:10 AM






Hi everyone,

I'm trying to run a scheduled task on an SQL7 server from
Access97.
I can run the task by raising a custom error from Access97
which runs the scheduled task.
However, I don't see when the job ends or if it ends in an
error.
Does anybody know how to do this?

TIA, Ray

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Check if scheduled job has ended - 10-20-2003 , 01:20 AM






You can use the DMO library to check the LastRunOutcome property.

For telling if a job has finished I usually insert a record into a control
table and read from that so I may have

CREATE TABLE JobControl
(
JobRunID INT PRIMARY KEY,
JobName varchar(50) NOT NULL,
JobExecuteTime smalldatetime,
JobEndTime smalldatetime
)

This way you can also check how long the job has been runnng so you know if
it caught up on something.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Ray" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi everyone,

I'm trying to run a scheduled task on an SQL7 server from
Access97.
I can run the task by raising a custom error from Access97
which runs the scheduled task.
However, I don't see when the job ends or if it ends in an
error.
Does anybody know how to do this?

TIA, Ray



Reply With Quote
  #3  
Old   
 
Posts: n/a

Default Check if scheduled job has ended - 10-20-2003 , 01:23 AM



Probalby usefull information:

I use Xp_logevent to trigger the job!

Reply With Quote
  #4  
Old   
 
Posts: n/a

Default Re: Check if scheduled job has ended - 10-20-2003 , 01:32 AM



Maybe a stupid question but how do you fill the jobendtime
in the Jobcontrol table?
Ray
Quote:
-----Original Message-----
You can use the DMO library to check the LastRunOutcome
property.

For telling if a job has finished I usually insert a
record into a control
table and read from that so I may have

CREATE TABLE JobControl
(
JobRunID INT PRIMARY KEY,
JobName varchar(50) NOT NULL,
JobExecuteTime smalldatetime,
JobEndTime smalldatetime
)

This way you can also check how long the job has been
runnng so you know if
it caught up on something.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Ray" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:018b01c396d0$e7527290$a001280a (AT) phx (DOT) gbl...
Hi everyone,

I'm trying to run a scheduled task on an SQL7 server
from
Access97.
I can run the task by raising a custom error from
Access97
which runs the scheduled task.
However, I don't see when the job ends or if it ends in
an
error.
Does anybody know how to do this?

TIA, Ray


.


Reply With Quote
  #5  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Check if scheduled job has ended - 10-20-2003 , 02:37 AM



When the job finishes (Final Step) Update the row for that job name where
the JobEndTime IS NULL

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



<anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Maybe a stupid question but how do you fill the jobendtime
in the Jobcontrol table?
Ray
-----Original Message-----
You can use the DMO library to check the LastRunOutcome
property.

For telling if a job has finished I usually insert a
record into a control
table and read from that so I may have

CREATE TABLE JobControl
(
JobRunID INT PRIMARY KEY,
JobName varchar(50) NOT NULL,
JobExecuteTime smalldatetime,
JobEndTime smalldatetime
)

This way you can also check how long the job has been
runnng so you know if
it caught up on something.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Ray" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:018b01c396d0$e7527290$a001280a (AT) phx (DOT) gbl...
Hi everyone,

I'm trying to run a scheduled task on an SQL7 server
from
Access97.
I can run the task by raising a custom error from
Access97
which runs the scheduled task.
However, I don't see when the job ends or if it ends in
an
error.
Does anybody know how to do this?

TIA, Ray


.




Reply With Quote
  #6  
Old   
Ray
 
Posts: n/a

Default Re: Check if scheduled job has ended - 10-20-2003 , 05:00 AM



I can't seem to figure out when the job ends.
I've tried looking in the msdb..sysjobs and
msdb..sysjobhistory but it seems that these tables don't
get changed until the process is done. Is there anywhere
you can see if it is still running or am I just being a
dumbass and looking in the wrong places?

TIA
Quote:
-----Original Message-----
When the job finishes (Final Step) Update the row for
that job name where
the JobEndTime IS NULL

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:04a301c396d3$f14b36d0$a401280a (AT) phx (DOT) gbl...
Maybe a stupid question but how do you fill the
jobendtime
in the Jobcontrol table?
Ray
-----Original Message-----
You can use the DMO library to check the LastRunOutcome
property.

For telling if a job has finished I usually insert a
record into a control
table and read from that so I may have

CREATE TABLE JobControl
(
JobRunID INT PRIMARY KEY,
JobName varchar(50) NOT NULL,
JobExecuteTime smalldatetime,
JobEndTime smalldatetime
)

This way you can also check how long the job has been
runnng so you know if
it caught up on something.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Ray" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:018b01c396d0$e7527290$a001280a (AT) phx (DOT) gbl...
Hi everyone,

I'm trying to run a scheduled task on an SQL7 server
from
Access97.
I can run the task by raising a custom error from
Access97
which runs the scheduled task.
However, I don't see when the job ends or if it ends
in
an
error.
Does anybody know how to do this?

TIA, Ray


.



.


Reply With Quote
  #7  
Old   
Darren Green
 
Posts: n/a

Default Re: Check if scheduled job has ended - 10-20-2003 , 05:41 AM



I have a system built around explicit logging of the start of a job, an
regular monitoring through xp_sqlagent_enum_jobs.
Every job starts with a step that logs the start to a table. It also
calculates a time threshold, based on the history, for which the job should
not exceed. This is then logged alongside the start time in a table.

A regular monitor job uses xp_sqlagent_enum_jobs to see what jobs are
running at that point on time. If any jobs are running that have now
exceeded the threshold it fires of a warning.


--
Darren Green
http://www.sqldts.com


"Ray" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I can't seem to figure out when the job ends.
I've tried looking in the msdb..sysjobs and
msdb..sysjobhistory but it seems that these tables don't
get changed until the process is done. Is there anywhere
you can see if it is still running or am I just being a
dumbass and looking in the wrong places?

TIA
-----Original Message-----
When the job finishes (Final Step) Update the row for
that job name where
the JobEndTime IS NULL

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:04a301c396d3$f14b36d0$a401280a (AT) phx (DOT) gbl...
Maybe a stupid question but how do you fill the
jobendtime
in the Jobcontrol table?
Ray
-----Original Message-----
You can use the DMO library to check the LastRunOutcome
property.

For telling if a job has finished I usually insert a
record into a control
table and read from that so I may have

CREATE TABLE JobControl
(
JobRunID INT PRIMARY KEY,
JobName varchar(50) NOT NULL,
JobExecuteTime smalldatetime,
JobEndTime smalldatetime
)

This way you can also check how long the job has been
runnng so you know if
it caught up on something.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Ray" <anonymous (AT) discussions (DOT) microsoft.com> wrote in
message
news:018b01c396d0$e7527290$a001280a (AT) phx (DOT) gbl...
Hi everyone,

I'm trying to run a scheduled task on an SQL7 server
from
Access97.
I can run the task by raising a custom error from
Access97
which runs the scheduled task.
However, I don't see when the job ends or if it ends
in
an
error.
Does anybody know how to do this?

TIA, Ray


.



.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.