如果您不了解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 Blog。