zoukankan      html  css  js  c++  java
  • sql server 发送邮件

    -- BI EMAIL

    declare @CC varchar(10),@MAIL varchar(500), @str varchar(800),@year varchar(4),@month varchar(2);
    declare @file_name varchar(50);
    declare @mail_subject varchar(50);
    declare @htmlBody varchar(max);
    SELECT @year = CONVERT(VARCHAR(4),DATEPART(year,dateadd(MONTH,-1,GETDATE()))) ;
    SELECT @month = right('0'+CONVERT(VARCHAR(2),DATEPART(month,dateadd(MONTH,-1,GETDATE()))),2);
    SELECT @MAIL='BI@163.com.cn';
     begin
      set @htmlBody=
      N'<H1 style="margin-left:30px; "><a href="http://msbi.dcec.com.cn/pbreports"><font size="4">TOP 10 ETL数据仓库抽取错误日志(点击查看明细)</font></a></H1>' +
      N'<table border="1" style="border:1px solid #d5d5d5;border-collapse:collapse;border-spacing:0;margin-left:30px;margin-top:20px;">' +
      N'<tr style="height:25px;"><th width=60px" >表名</th>'+
      N'<th width=50px>包名</th><th width=120px>抽取时间</th>'+
      N'<th width=150px>错误信息</th>'+
      
      CAST ( (
      select td=a.table_name, '',td=a.package_name, '',td=a.process_starttime,'', td=a.error_description, ''
      
      from (select top 10 table_name,package_name,process_starttime,error_description
       from tempdb.dbo.bi_etl_error ) a
      FOR XML PATH('tr'), TYPE
      ) AS NVARCHAR(MAX) ) +
      N'</table>';
      --select @htmlBody;
      set @mail_subject='数据仓库加载数据ETL任务失败';
      
      
      exec msdb.dbo.sp_send_dbmail
      @profile_name='BIMAIL',
      @recipients=@MAIL,
      @subject=@mail_subject,
      @body=@htmlBody,
      --@execute_query_database='ReportServer',
      --@query='select * from dbo.Roles',
      --@attach_query_result_as_file=1,
      --@query_attachment_filename=N'a.xlsx'
      --@file_attachments=@file_name
      @body_format='HTML'; 
      
     end
     
  • 相关阅读:
    散列
    红黑树
    发散二叉搜索树
    二叉搜索树的删除和联结
    平衡树
    二叉搜索树的划分
    在二叉搜索树的根进行插入
    paper169:2020CVPR文章解读:nestedVAE:Isolating common facters via weak supervision
    paper 168: 2018-FATTEN 论文解析-feature space transfer for data augmentation
    paper 167:GPU的使用Theano之tutorial
  • 原文地址:https://www.cnblogs.com/shuihaya/p/12098656.html
Copyright © 2011-2022 走看看