日期:2014-05-17 浏览次数:20633 次
DECLARE @tableHTML NVARCHAR(MAX) ;
DECLARE @date SMALLDATETIME
SET @date = CONVERT(CHAR(10), GETDATE(), 120)
DECLARE @title NVARCHAR(64)
SELECT @title = CONVERT(CHAR(10), GETDATE(), 120) + ' Jobs Report '
DECLARE @DBA NVARCHAR(1024)
SET @DBA = 'XXX@XXX.com;XXX@139.com'
SET @tableHTML = N'<H1>Jobs Report</H1>' + N'<table border="1">'
+ N'<tr><th>作业名</th><th>最近执行时间</th>'
+ N'<th>最近执行状态</th><th>运行持续时间</th><th>最近运行状态信息</th>'
+ N'<th>下次运行时间</th></tr>'
+ CAST(( SELECT td = [sJOB].[name] ,
'' ,
td = CASE WHEN ( [sJOBH].[run_date] IS NULL
OR [sJOBH].[run_time] IS NULL
) THEN NULL
ELSE CAST(CAST([sJOBH].[run_date] AS CHAR(8))
+ ' ' + STUFF(STUFF(RIGHT('000000'
+ CAST([sJOBH].[run_time] AS VARCHAR(6)),