Welcome to AspAdvice Sign in | Join | Help

Orcs Goblins and .NET

I enjoy reading and writing. I hope you enjoy at least the former.

Copying Data From SQL Server Management Studio

I often write queries in SQL Server Management Studio to find different bits of information about which I am curious. This is quite easy and I discover a lot of useful and interesting things this way. You might ask why I am writing this blog post. I'll first say that I try to share these little tidbits with others. Sure I could bring people over to my computer and show them these nifty collections of data with certain meanings, but that would just be silly. I need to store it elsewhere and email it.

Maybe I'm just going about things the wrong way, but I've tried to copy and paste from SSMS into Outlook and that doesn't usually work well. Outlook doesn't seem to figure out that I would like my data pasted as a table, so I usually throw it into Excel first. Doing this will get my data into a nice tabular format.

Now that I've finally gotten my tabular data into a table everything is great. Right? No. I lose once again. I don't have the column names with my data so I end up with something like this and without column names people will not know what I am trying to tell them.

Brendan McAwesome Enrick 5555555555 12345 9876543
John Michael Smith 1234678910 1337 31337

So then I have to go and type out column names so that the people I send this to know what it is. Now for this example it wouldn't be too bad, but sometimes I'll be sending 10 columns worth of data and that is just annoying. I wish I could just copy out of SQL Server and have it pull column names at least then my Excel trick would at least work. If anyone knows a nice easy way to just copy out of SSMS please let me know it would make things so much easier.

Perhaps you can find some elusive option names similarly to Copy All Data With Column Names, because I sure as hell haven't found it.

In case you are wondering those column names are; FirstName, MiddleName, LastName, Phone, SomeValue, SomeOtherValue.

Sponsor

Published Friday, November 30, 2007 1:16 PM by Brendan

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Copying Data From SQL Server Management Studio @ Friday, November 30, 2007 3:08 PM

Tools - Options - Query Results - Results to Grid - Include column headers when copying or saving the results

Bryce

# re: Copying Data From SQL Server Management Studio @ Friday, November 30, 2007 3:45 PM

Awesome Bryce!

Thank you very much. I figured I'd get an answer if I ranted about this.

Brendan

# Save SQL Query Results With Column Names @ Saturday, December 01, 2007 7:28 PM

A minor frustration I've had with SQL Server for years is that when copying the results to Excel,

Steven Smith

# re: Copying Data From SQL Server Management Studio @ Tuesday, January 29, 2008 8:11 PM

This still won't work for me!! :(

susan

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below