19 October 2009

Weekly Dynamic: Copy Headings and Data from SQL

Doing data validation, database compares and other queries in SQL Server is a pretty common occurrence when working with Dynamics GP, especially during implementation. Often this involves running a SQL query in Management Studio and pasting the results into a spreadsheet or document. Many people don't know that a feature in Management Studio is the ability to copy the headings as well as the results with copy and paste.

This is not just a new feature in SQL 2008 but it works in SQL 2005, the feature is just not on by default. To turn it on, select Tools-Options in SQL Server Management Studio. Expand Query Results with the +. Expand SQL Server. Select Results to Grid and check the box "Include Column headers when copying or saving the results." Click Ok.


I felt dumb when I found this the first time but I feel brilliant every time I show it to someone else!