Hey guys,
I need to know the current status for a job that i started.
I knew that sp_help_job give me all this information, but i have to do IFs, so I have to set a variable with this result. I only need the columns last_run_outcome and current_execution_status.
How do I to get only this values from a Job_id ??
i Looked in almost all table from msdb to find these 2 columns and nothing ... :/
Anyone can helpme ?The Answer Is :
use master
exec sp_addlinkedserver @.server = 'LocalServer',
@.srvproduct = '',
@.provider = 'SQLOLEDB',
@.datasrc = @.@.servername
go
select last_run_outcome, current_execution_status from openquery(LocalServer, 'set fmtonly off; exec msdb.dbo.sp_help_job')
go
exec sp_dropserver 'LocalServer'
U donot need to drop the linked server, I did that to ensure that noerror will be shoed when adding linked servers
Bye
Showing posts with label current. Show all posts
Showing posts with label current. Show all posts
Wednesday, March 28, 2012
job status
Hi,
Is it possible to find out the current status of a job (sql 2000 sql job),
i.e. whether it is idle/running/failed, etc
Thanks in advance!!Try giving select privilages to msdb..sysjobhistory and msdb..sysjobs
tables.
select name,run_status from msdb..sysjobhistory a,sysjobs b
where a.job_id=b.job_id
and name='name of the job'
explanation for run_status:- You could write a case statement with
run_status with below description.
0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress
Thanks
Hari
"AppleDopod" <hk_007@.hotmail.com> wrote in message
news:%23NlymnYUHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Is it possible to find out the current status of a job (sql 2000 sql job),
> i.e. whether it is idle/running/failed, etc
> Thanks in advance!!
>|||Please have a look at this script:
http://www.replicationanswers.com/Downloads/KillRunningJobs.txt. You can
use -- 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle,
5 = Suspended, 6 = [obsolete], 7 = PerformingCompletionActions to modify it
as you like.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.comsql
Is it possible to find out the current status of a job (sql 2000 sql job),
i.e. whether it is idle/running/failed, etc
Thanks in advance!!Try giving select privilages to msdb..sysjobhistory and msdb..sysjobs
tables.
select name,run_status from msdb..sysjobhistory a,sysjobs b
where a.job_id=b.job_id
and name='name of the job'
explanation for run_status:- You could write a case statement with
run_status with below description.
0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress
Thanks
Hari
"AppleDopod" <hk_007@.hotmail.com> wrote in message
news:%23NlymnYUHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Is it possible to find out the current status of a job (sql 2000 sql job),
> i.e. whether it is idle/running/failed, etc
> Thanks in advance!!
>|||Please have a look at this script:
http://www.replicationanswers.com/Downloads/KillRunningJobs.txt. You can
use -- 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle,
5 = Suspended, 6 = [obsolete], 7 = PerformingCompletionActions to modify it
as you like.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.comsql
job status
Hi,
Is it possible to find out the current status of a job (sql 2000 sql job),
i.e. whether it is idle/running/failed, etc
Thanks in advance!!Try giving select privilages to msdb..sysjobhistory and msdb..sysjobs
tables.
select name,run_status from msdb..sysjobhistory a,sysjobs b
where a.job_id=b.job_id
and name='name of the job'
explanation for run_status:- You could write a case statement with
run_status with below description.
0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress
Thanks
Hari
"AppleDopod" <hk_007@.hotmail.com> wrote in message
news:%23NlymnYUHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Is it possible to find out the current status of a job (sql 2000 sql job),
> i.e. whether it is idle/running/failed, etc
> Thanks in advance!!
>|||Please have a look at this script:
http://www.replicationanswers.com/D...unningJobs.txt. You can
use -- 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle,
5 = Suspended, 6 = [obsolete], 7 = PerformingCompletionActions to modify
it
as you like.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
Is it possible to find out the current status of a job (sql 2000 sql job),
i.e. whether it is idle/running/failed, etc
Thanks in advance!!Try giving select privilages to msdb..sysjobhistory and msdb..sysjobs
tables.
select name,run_status from msdb..sysjobhistory a,sysjobs b
where a.job_id=b.job_id
and name='name of the job'
explanation for run_status:- You could write a case statement with
run_status with below description.
0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress
Thanks
Hari
"AppleDopod" <hk_007@.hotmail.com> wrote in message
news:%23NlymnYUHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Is it possible to find out the current status of a job (sql 2000 sql job),
> i.e. whether it is idle/running/failed, etc
> Thanks in advance!!
>|||Please have a look at this script:
http://www.replicationanswers.com/D...unningJobs.txt. You can
use -- 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle,
5 = Suspended, 6 = [obsolete], 7 = PerformingCompletionActions to modify
it
as you like.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
job status
Hi,
Is it possible to find out the current status of a job (sql 2000 sql job),
i.e. whether it is idle/running/failed, etc
Thanks in advance!!
Try giving select privilages to msdb..sysjobhistory and msdb..sysjobs
tables.
select name,run_status from msdb..sysjobhistory a,sysjobs b
where a.job_id=b.job_id
and name='name of the job'
explanation for run_status:- You could write a case statement with
run_status with below description.
0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress
Thanks
Hari
"AppleDopod" <hk_007@.hotmail.com> wrote in message
news:%23NlymnYUHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Is it possible to find out the current status of a job (sql 2000 sql job),
> i.e. whether it is idle/running/failed, etc
> Thanks in advance!!
>
|||Please have a look at this script:
http://www.replicationanswers.com/Downloads/KillRunningJobs.txt. You can
use -- 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle,
5 = Suspended, 6 = [obsolete], 7 = PerformingCompletionActions to modify it
as you like.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
Is it possible to find out the current status of a job (sql 2000 sql job),
i.e. whether it is idle/running/failed, etc
Thanks in advance!!
Try giving select privilages to msdb..sysjobhistory and msdb..sysjobs
tables.
select name,run_status from msdb..sysjobhistory a,sysjobs b
where a.job_id=b.job_id
and name='name of the job'
explanation for run_status:- You could write a case statement with
run_status with below description.
0 = Failed
1 = Succeeded
2 = Retry
3 = Canceled
4 = In progress
Thanks
Hari
"AppleDopod" <hk_007@.hotmail.com> wrote in message
news:%23NlymnYUHHA.4872@.TK2MSFTNGP03.phx.gbl...
> Hi,
> Is it possible to find out the current status of a job (sql 2000 sql job),
> i.e. whether it is idle/running/failed, etc
> Thanks in advance!!
>
|||Please have a look at this script:
http://www.replicationanswers.com/Downloads/KillRunningJobs.txt. You can
use -- 1 = Executing, 2 = Waiting For Thread, 3 = Between Retries, 4 = Idle,
5 = Suspended, 6 = [obsolete], 7 = PerformingCompletionActions to modify it
as you like.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
Wednesday, March 21, 2012
Job History is missing
I've come into a new SQL server 200o environment and for some reason, none of
the jobs keeps a history past one day. The current production DBA says he has
no idea what's causing it. Does anyone have any experience with this issue?
Thanks in advance.See if the size of the job history has been limited. This can be found in
Enterprise Manager by selecting your server, going to Management, then right
click on SQL Server Agent and select properties. The Job System tab has
options for limiting the size of the job history log.
--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
> I've come into a new SQL server 200o environment and for some reason, none
> of
> the jobs keeps a history past one day. The current production DBA says he
> has
> no idea what's causing it. Does anyone have any experience with this
> issue?
> Thanks in advance.|||Thanks Ben, that was fast. I think that will do it. Thanks again.
Ed
"Ben Lucas" wrote:
> See if the size of the job history has been limited. This can be found in
> Enterprise Manager by selecting your server, going to Management, then right
> click on SQL Server Agent and select properties. The Job System tab has
> options for limiting the size of the job history log.
> --
> Ben Lucas
> Lead Developer
> Solien Technology, Inc.
> www.solien.com
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
> > I've come into a new SQL server 200o environment and for some reason, none
> > of
> > the jobs keeps a history past one day. The current production DBA says he
> > has
> > no idea what's causing it. Does anyone have any experience with this
> > issue?
> >
> > Thanks in advance.
>
>
the jobs keeps a history past one day. The current production DBA says he has
no idea what's causing it. Does anyone have any experience with this issue?
Thanks in advance.See if the size of the job history has been limited. This can be found in
Enterprise Manager by selecting your server, going to Management, then right
click on SQL Server Agent and select properties. The Job System tab has
options for limiting the size of the job history log.
--
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
> I've come into a new SQL server 200o environment and for some reason, none
> of
> the jobs keeps a history past one day. The current production DBA says he
> has
> no idea what's causing it. Does anyone have any experience with this
> issue?
> Thanks in advance.|||Thanks Ben, that was fast. I think that will do it. Thanks again.
Ed
"Ben Lucas" wrote:
> See if the size of the job history has been limited. This can be found in
> Enterprise Manager by selecting your server, going to Management, then right
> click on SQL Server Agent and select properties. The Job System tab has
> options for limiting the size of the job history log.
> --
> Ben Lucas
> Lead Developer
> Solien Technology, Inc.
> www.solien.com
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
> > I've come into a new SQL server 200o environment and for some reason, none
> > of
> > the jobs keeps a history past one day. The current production DBA says he
> > has
> > no idea what's causing it. Does anyone have any experience with this
> > issue?
> >
> > Thanks in advance.
>
>
Job History is missing
I've come into a new SQL server 200o environment and for some reason, none of
the jobs keeps a history past one day. The current production DBA says he has
no idea what's causing it. Does anyone have any experience with this issue?
Thanks in advance.
See if the size of the job history has been limited. This can be found in
Enterprise Manager by selecting your server, going to Management, then right
click on SQL Server Agent and select properties. The Job System tab has
options for limiting the size of the job history log.
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
> I've come into a new SQL server 200o environment and for some reason, none
> of
> the jobs keeps a history past one day. The current production DBA says he
> has
> no idea what's causing it. Does anyone have any experience with this
> issue?
> Thanks in advance.
|||Thanks Ben, that was fast. I think that will do it. Thanks again.
Ed
"Ben Lucas" wrote:
> See if the size of the job history has been limited. This can be found in
> Enterprise Manager by selecting your server, going to Management, then right
> click on SQL Server Agent and select properties. The Job System tab has
> options for limiting the size of the job history log.
> --
> Ben Lucas
> Lead Developer
> Solien Technology, Inc.
> www.solien.com
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
>
>
the jobs keeps a history past one day. The current production DBA says he has
no idea what's causing it. Does anyone have any experience with this issue?
Thanks in advance.
See if the size of the job history has been limited. This can be found in
Enterprise Manager by selecting your server, going to Management, then right
click on SQL Server Agent and select properties. The Job System tab has
options for limiting the size of the job history log.
Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com
"Ed" <Ed@.discussions.microsoft.com> wrote in message
news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
> I've come into a new SQL server 200o environment and for some reason, none
> of
> the jobs keeps a history past one day. The current production DBA says he
> has
> no idea what's causing it. Does anyone have any experience with this
> issue?
> Thanks in advance.
|||Thanks Ben, that was fast. I think that will do it. Thanks again.
Ed
"Ben Lucas" wrote:
> See if the size of the job history has been limited. This can be found in
> Enterprise Manager by selecting your server, going to Management, then right
> click on SQL Server Agent and select properties. The Job System tab has
> options for limiting the size of the job history log.
> --
> Ben Lucas
> Lead Developer
> Solien Technology, Inc.
> www.solien.com
> "Ed" <Ed@.discussions.microsoft.com> wrote in message
> news:881853B8-2F60-4017-8F01-44FBF863BFAF@.microsoft.com...
>
>
Subscribe to:
Posts (Atom)