利用sqlserver Job 及內嵌儲存過程傳送郵件

terryisme發表於2009-09-08

if day(getdate()) = 1 begin
exec master.dbo.xp_sendmail
@recipients = 'wangwx@huntkey.net',
@blind_copy_recipients ='zhangyun@hk.net',
@attachments = '192.168.12.12ftp$csvlocdetloctype1.csv;192.168.12.12ftp$csvlocdetloctype2.csv;192.168.12.12ftp$csvlocdetloctype3.csv;192.168.12.12ftp$csvlocdetlocdet1.csv;192.168.12.12ftp$csvlocdetlocdet2.csv;192.168.12.12ftp$csvlocdetlocdet3.csv;192.168.12.12ftp$csvlocdetlocdet11.csv;192.168.12.12ftp$csvlocdetlocdet12.csv;192.168.12.12ftp$csvlocdetlocdet13.csv',
@subject = '庫存分類彙總表',
@message = '請參照附件'
end
else begin
exec master.dbo.xp_sendmail
@recipients = 'wangwx@huntkey.net',
@blind_copy_recipients ='zhangyun@huntkey.net',
@attachments = '192.168.12.12ftp$csvlocdetloctype1.csv;192.168.12.12ftp$csvlocdetloctype2.csv;192.168.12.12ftp$csvlocdetloctype3.csv;192.168.12.12ftp$csvlocdetlocdet1.csv;192.168.12.12ftp$csvlocdetlocdet2.csv;192.168.12.12ftp$csvlocdetlocdet3.csv',
@subject = '庫存分類彙總表',
@message = '請參照附件'
end
---參考sqlserver2005郵件配置

在 SQL Server 2005 中配置資料庫郵件,傳送郵件

配置SQL Server 2005資料庫郵件
http://blog.csdn.net/iwilltrybest/archive/2008/05/26/2481666.aspx

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/93029/viewspace-1026770/,如需轉載,請註明出處,否則將追究法律責任。

相關文章