TSQL使用DbMail发送多个附件

   如果您不了解DbMail,先看sp_send_dbmail.具体的T-SQL如下:
 
   1:  SET ROWCOUNT 0 
   2:  EXEC msdb.dbo.sp_send_dbmail
   3:  @profile_name = 'Your_Server_Profile',
   4:  @recipients = 'recipient.1@xyz.com; recipient.2@xyz.com',
   5:  @body = 'Reports 1 and 2 are attached',
   6:  @file_attachments = 'C:\Report Folder\Report1.TXT;C:\Report Folder\Report2.TXT',
   7:  @subject = 'Reports 1 and 2 are attached' ;

     注意你必须设置rowcount为0,希望对您有帮助。


作者:Petter Liu
出处:http://www.cnblogs.com/wintersun/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
该文章也同时发布在我的独立博客中-Petter Liu Blog

原文地址:https://www.cnblogs.com/wintersun/p/1793813.html