标签:
DECLARE
@tab char(1) = CHAR(9)
EXEC msdb.dbo.sp_send_dbmail
@profile_name = ‘backupNotify‘,
@recipients = ‘xxx@wuxiapptec.com‘,
@query = ‘select cardno,badge,empname,empdep,swptime,macip from CanteenProject.dbo.ADSSwipData where badge like ‘‘T%‘‘ and (swptime>CONVERT(varchar(7),DATEADD(mm,-1,GETDATE()),23)+‘‘-21‘‘ and swptime<CONVERT(varchar(7),GETDATE(),23)+‘‘-21‘‘)‘,
@subject = ‘Monthly Trainees Checkin Log‘,
@attach_query_result_as_file = 1,
@query_attachment_filename=‘TraineesCheckin-ConfidentialData.csv‘,
@query_result_separator=@tab,
@query_result_no_padding=1
单独执行上面的语句,报错:
File attachment or query results size exceeds allowable value of 1000000 bytes.
解决办法:
配置‘数据库邮件’,将‘最大文件大小(字节)’设置得大些。
File attachment or query results size exceeds allowable value of 1000000 bytes
标签:
原文地址:http://blog.csdn.net/chinadm123/article/details/45889321