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 ifs. Show all posts
Showing posts with label ifs. Show all posts
Subscribe to:
Posts (Atom)