用SQL Server 2005發送郵件的功能

簡略介紹SQL Server 2005發送郵件的功能

用SQL Server 2005發送郵件:

 

  1. EXEC msdb.dbo.sp_send_dbmail  
  2.     @profile_name = 'test',  
  3.     @recipients = '[email protected];[email protected]',  
  4.     --@recipients = '[email protected]',  
  5.     @body = '用msdb.dbo.sp_send_dbmail測試發郵件,不用猜了,我是謙',  
  6.     @subject = '測試發郵件 sql查詢',  
  7.     @query = ' select 表名=name,類型=case xtype when ''S'' then ''系統表'' else ''用戶表'' end from sysobjects where xtype in(''U'',''S'') ',   
  8.     @attach_query_result_as_file = 1,  
  9.     @query_attachment_filename = 'Results.txt'

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章