SQL SERVER – Copy Column Headers from Resultset – SQL in Sixty Seconds #027 – Video

SQL SERVER - Copy Column Headers from Resultset - SQL in Sixty Seconds #027 - Video sixtysecs SQL Server Management Studio returns results in Grid View, Text View and to the file. When we copy results from the Grid View to Excel there is a common complaint that the column  header displayed in resultset is not copied to the Excel. I often spend time in performance tuning databases and I run many DMV’s in SSMS to get a quick view of the server. In my case it is almost certain that I need all the time copy column headers when I copy my data to excel or any other place.

SQL Server Management Studio has two different ways to do this.

Method 1: Ad-hoc

When the result is rendered you can right click on the resultset and click on Copy Header. This will copy the headers along with the resultset. Additionally, you can use the shortcut key CTRL+SHIFT+C for coping, column headers along with the result set.

SQL SERVER - Copy Column Headers from Resultset - SQL in Sixty Seconds #027 - Video 27-800x450

Method 2: Option Setting at SSMS level

This is SSMS level settings and I kept this option always selected as I often need the column headers when I select the resultset.

Go Tools >> Options >> Query Results >> SQL Server >> Results to Grid >> Check the Box “Include column header when copying or saving the results.”

Both of the methods are discussed in following SQL in Sixty Seconds Video.


Here is the code used in the video.

Related Tips in SQL in Sixty Seconds:

If we like your idea we promise to share with you educational material.

Reference: Pinal Dave (https://blog.sqlauthority.com)

, , , ,
Previous Post
SQL SERVER – Effect of Collation on Resultset – SQL in Sixty Seconds #026 – Video
Next Post
SQL SERVER – Identify Most Resource Intensive Queries – SQL in Sixty Seconds #028 – Video

Related Posts

6 Comments. Leave new

Leave a Reply

Menu