SQL Agent Job Running Status

IF EXISTS(SELECT 1

          FROM msdb.dbo.sysjobs J

          JOIN msdb.dbo.sysjobactivity A

              ON A.job_id=J.job_id

          WHERE J.name=N'Your Job Name'

          AND A.run_requested_date IS NOT NULL

          AND A.stop_execution_date IS NULL

         )

    PRINT 'The job is running!'

ELSE

    PRINT 'The job is not running.'

 

 

Comments

  1. Great article, Thank you for sharing this valuable info with us.

    ReplyDelete

Post a Comment

Hi User,
Thanks for visiting My Blog and please provide your valuable feedback and subscribe for more updates. Please don't post any spam content or comments.
Thank You

Popular Posts

Failed to execute the package or element. Build errors were encountered

Restore of database 'DataBase_Name' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)

Cannot convert "Column" between a unicode and a non-unicode string data types in SSIS