Home Forums Data Warehousing Integration Services Output the Results of T-SQL Query to an e-mail attachment and/ or Body RE: Output the Results of T-SQL Query to an e-mail attachment and/ or Body

  • Chris Harshman (12/1/2016)


    the obvious answer would be sp_send_dbmail:

    https://msdn.microsoft.com/en-us/library/ms190307.aspx

    I prefer to use the @attach_query_result_as_file=1 option, because the results are often easier to read in the text file than in the body where outlook would spoil the formatting.

    is database mail not setup in your environment?

    I like your approach.

    Thanks.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/