dbTalk Databases Forums  

How to check job status?

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


Discuss How to check job status? in the microsoft.public.sqlserver.dts forum.



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

Default How to check job status? - 02-20-2004 , 10:43 AM






How to check SQL Agent job status by using VB Scripts
from command prompt?
Thanks for help.

-Tom

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

Default Re: How to check job status? - 02-20-2004 , 02:29 PM






you can use

SQL DMO
sp_help_job
sp_help_jobhistory

What do you mean by status?

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


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

Quote:
How to check SQL Agent job status by using VB Scripts
from command prompt?
Thanks for help.

-Tom



Reply With Quote
  #3  
Old   
Uwe Müller
 
Posts: n/a

Default Re: How to check job status? - 02-23-2004 , 09:55 AM



Hi Tom

take that vb sample (with rdo, can be changed to ado)

Set rs = rc.OpenResultset("msdb.dbo.sp_help_jobserver @job_name =
'speed_daten_holen', @show_last_run_details = 1")

If Not rs.EOF Then

If rs.rdoColumns(4) < CLng(Format(Date, "yyyymmdd")) _
Or (rs.rdoColumns(4) = CLng(Format(Date, "yyyymmdd") _
And rs.rdoColumns(5) < starttime)) Then Exit Sub

If rs.rdoColumns(7) = "1" Then
MsgBox "all ok"
Else
Select Case rs.rdoColumns(7)
Case "0"
f = "job closed with error"
Case "3"
f = "job aborted"
Case Else
f = "unknown error"
End Select
MsgBox f
End If

End 'programm beenden

End If

hope this helps
Uwe


"Tom Torain" <anonymous (AT) discussions (DOT) microsoft.com> schrieb im Newsbeitrag
news:131cd01c3f7d0$a889d790$a101280a (AT) phx (DOT) gbl...
Quote:
How to check SQL Agent job status by using VB Scripts
from command prompt?
Thanks for help.

-Tom



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.