簡略介紹SQL Server 2005發送郵件的功能
用SQL Server 2005發送郵件:
- EXEC msdb.dbo.sp_send_dbmail
- @profile_name = 'test',
- @recipients = '[email protected];[email protected]',
- --@recipients = '[email protected]',
- @body = '用msdb.dbo.sp_send_dbmail測試發郵件,不用猜了,我是謙',
- @subject = '測試發郵件 sql查詢',
- @query = ' select 表名=name,類型=case xtype when ''S'' then ''系統表'' else ''用戶表'' end from sysobjects where xtype in(''U'',''S'') ',
- @attach_query_result_as_file = 1,
- @query_attachment_filename = 'Results.txt';