How do I attach query results to send mail

I have several tasks that I don't want to use conditional failure on. I have a ON ERROR send mail task right now that works. I want to have that send mail task include query results from a separate query. How do I do that

Peter Cwik



Answer this question

How do I attach query results to send mail

  • Sneha Desai

    Good job Jamie , but you didn't mention the way how to send the flat rate by email !!!


  • NonExisto

    How about dropping the result of the query into a file usig the Flat File Destination and then attaching that file within Send Mail Task

    Just an idea...

    -Jamie



  • cakehole

    That part makes sense.

    Thanks!


  • BryanCTG

    SSIS is new to me...how do I do that
  • Brian King Microsoft

    Once you have the text file created as Jamie said you can attch the file by send mail task. Or if you want the output in the body of the mail then you can attain that by using script task, even you can make the result as HTML format also.


  • Mr Steve

    What I just descibed is slightly advanced because it required the use of expressions. I don't want to try and cover those before you know the basics.

    If I were you I would build the bit that populates a flat file first. You'll need a new data-flow. Drop an OLE DB Source Adapter into your data flow. Paste your query into the OLE DB Source Adapter.

    Then, drop a Flat File Destination Adapter onto the data-flow. Drag a data path between your source adapter and your destination adapter. Open up the destination adapter editor and accept all the defaults - including building your flat file connection manager.

    If none of that makes any sense then i recommend you work your way through the SSIS tutorial provided off the SQL Server install CD.

    -Jamie



  • How do I attach query results to send mail