• Hi

    I am using below script to check the jobs daily. How can I use this script and add the HTML and email notification to the script? Thank you

    --Check Jobs

    select *

    into #Lastinstance

    from msdb.dbo.sysjobhistory where instance_id in(

    select max(instance_id) from msdb.dbo.sysjobhistory group by job_id)

    select

    sj.name,substring(cast(jh.run_date as char(8)),1,4)+'-'+

    substring(cast(jh.run_date as char(8)),5,2)+'-'+substring(cast(jh.run_date as char(8)),7,2),

    run_status Successfull,getdate(),jh.message

    from msdb.dbo.sysjobs sj

    join #Lastinstance jh on sj.job_id = jh.job_id

    where instance_id in(

    select max(instance_id) from msdb.dbo.sysjobhistory group by job_id

    ) and enabled = 1 and step_name = '(Job outcome)'

    order by run_date