Friday, June 29, 2007

Include Column Headers When Copying the Results

In Microsoft SQL Server Management Studio, there is now an option to include column headers with the rows that you copy from the results pane. For example, when I copy the following records from SQL Server Management Studio and pasting into Excel, I now know the names of the columns:

ID First Name Last Name
1 Robert Doe


To enable this feature in Management Studio, click Tools -> Options -> Query Results -> SQL Server -> Results to Grid and check 'Include column headers when copying or saving the results' and click OK. Click on the screenshot below for a screenshot.

No comments: