|
jackv
Flowing Fount of Yak Knowledge
United Kingdom
1795 Posts |
Posted - 12/11/2012 : 07:17:26
|
SQL Server comes with Database Mail . Configure Database mail and then use the msdb.dbo.sp_send_dbmail stored procedure ,with SQL Server Agent . Here is an example of the built in stored procedure. Using the @attach_query_result_as_file will attach the query results
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Main', @body = 'some body text', @subject = 'some subject text' , @recipients = 'user1@sqlserver-dba.com', @execute_query_database = 'MY_DB', @attach_query_result_as_file = 1, @query = 'EXEC mySp' go
Jack Vamvas -------------------- http://www.sqlserver-dba.com |
 |
|