Michael J. Swart

January 19, 2009

Sending Query Results to Colleagues

Filed under: Miscelleaneous SQL — Michael J. Swart @ 6:30 am

If I need to send data or query results to colleagues, I like to send them using Microsoft Excel Especially if it’s through email and the results aren’t so huge as to overwhelm the clipboard.
When doing this, there’s a couple things that I like to do to make my life easier:

First there’s an option that you might not have come across yet in management studio that includes the column names when copying the results. Under the Tools menu, select Options. The following dialog is shown:

Select Include column headers when copying or saving the results. This (as you might have guessed) saves some time when pasting into excel:


Update (Feb 5, 2009
): Interesting quirk about the above feature: Column headers aren’t included if there is only data from one column selected. Also this feature has no effect on existing query windows, only on newly opened windows. So without that knowledge, it might seem like this option has no effect.

The second thing I like to do is to include the query on Sheet 2 and format the results. I.e. formatting includes bolding the header, and enabling autofilter on the worksheet, etc…:
See an example (video).
It’s nice and it works. (But it’s not quite enough to justify it’s own Excel template). I think Excel does well for what it’s used for here: A portable, sortable, data viewer.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress