What is the best way to capture output from SQL Management Studio and paste it into Outlook email?

I constantly execute ad-hoc queries in SQL Management Studio and must send the results to people via email. This happens several times a day, so I’m looking for the best way to copy the query results from the results window into the body of the Outlook email so that it can be formatted in a reader-friendly form. I have not come up with anything that works well for me.

When it really matters, I log into Excel, executing the query from the inside, and then attaching the resulting table. I am looking for something that I can do without involving Excel, if possible. Any ideas?

+4
source share
3 answers

I am in Outlook 2010. From a blank message, you can click on the body, then "Table", "Excel Spreadsheet". This inserts the spreadsheet associated with Excel into the message body.

Then from SSMS, run the request in the grid - where I usually look at mine. Highlight the results, copy, then click on the first cell of the spreadsheet attached to the email and paste.

At least it looks half decent, and the recipient can right-click on the built-in spreadsheet, select "Worksheet / Open" and run it in Excel.

+2
source

Click Results to Text or Results to file in the SQL Editor toolbar.

+1
source

I think you can do this with the SSIS package. You can complete the request and send an email. Edit: It is possible to use SSRS, export the results to Excel, and attach to email.

0
source

Source: https://habr.com/ru/post/1342847/


All Articles