Tareas del SQL Server Agent, cómo obtengo su estado?

Si necesitan saber cuál es el estado de los trabajos calendarizados con el SQL Server Agent pueden utilizar el siguiente script

 

select name, description,start_execution_date,  stop_execution_date, 
  msdb.dbo.sysjobs.Job_ID, 
  job_status = CASE 
  WHEN start_execution_date IS NULL AND stop_execution_date IS NULL THEN 0 
  WHEN start_execution_date IS NOT NULL AND stop_execution_date IS NULL THEN 1   
  WHEN start_execution_date IS NOT NULL AND stop_execution_date IS NOT NULL THEN 2   
  ELSE 3
  END
FROM msdb.dbo.sysjobactivity JA inner join 
msdb.dbo.sysjobs 
ON JA.Job_ID = msdb.dbo.sysjobs.Job_ID 
 

Saludos,

Ing. Eduardo Castro Martínez, PhD – Microsoft SQL Server MVP

http://mswindowscr.org

http://comunidadwindows.org

Costa Rica

Technorati Tags: SQL Server

LiveJournal Tags: SQL Server

del.icio.us Tags: SQL Server

http://ecastrom.blogspot.com

http://ecastrom.wordpress.com

http://ecastrom.spaces.live.com

http://universosql.blogspot.com

http://todosobresql.blogspot.com

https://todosobresqlserver.wordpress.com

http://mswindowscr.org/blogs/sql/default.aspx

http://citicr.org/blogs/noticias/default.aspx

http://sqlserverpedia.blogspot.com/

Note: Cross posted from Eduardo Castro.

Permalink

Advertisements

%d bloggers like this: