Assuming you mean the query results, you can use the system stored procedure
sp_send_dbmail using the @query parameter. Here is example:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'MyProfile',
@recipients = 'foo@test.com',
@query = 'SELECT col1 FROM Foo' ,
@subject = 'Query results',
@attach_query_result_as_file = 1 ;
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Don Juan - 22 Jul 2008 06:57 GMT
Thanks!
> Assuming you mean the query results, you can use the system stored
> procedure sp_send_dbmail using the @query parameter. Here is example:
[quoted text clipped - 10 lines]
> Plamen Ratchev
> http://www.SQLStudio.com
You might want to consider using QueryToDoc Command Line Publisher (http://www.schematodoc.com). It's a console app that lets you run a query on a recurring schedule and have the results sent to people as an e-mail attachment in a Word, HTML, Excel or CSV format.