SQL Tips by Namwar Rizvi

August 27, 2008

How to copy query results With column headers?

Filed under: SQL Server 2005,tips — namwar @ 9:56 PM
Tags: , ,

It is a very common practice that sometime you need to copy the query results from SQL Server Management Studio (SSMS) results tab to excel or any other application. The problem normally we face is that it does copy column headers and you have to write the column headers by your self. Here is the quick tip to enable column headers copying.

  1. In SSMS, open Tools menu and click Options
  2. Expand Query Results node and click Results to Grid
  3. Check Include column headers when copying or saving the results. Your screen will look similar to following:
  4. Results To Grid Option Screen

  5. Click Save to save your settings.

Now, whenever you will copy the query results, column headers will be copied too.

Enjoy!

Advertisements

2 Comments »

  1. THANK YOU!!!!! 🙂

    Comment by Nate — November 25, 2008 @ 6:30 AM | Reply

  2. Cool, I was getting worried you couldn’t do it for a minute in 2008.

    Comment by Jim — May 1, 2012 @ 9:37 AM | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: