Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Copying Headers from SQL Query Window results in SQL 2005 Expand / Collapse
Author
Message
Posted Tuesday, October 26, 2010 1:02 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 10:05 AM
Points: 177, Visits: 355
I wanted to copy the headers of a query result to a excel spreadsheet. In the grid view mode, by default the query editor only allows the results to be copied.
Most of the suggested approaches indicated to change the "Default destination for results" value to "results mode to text". This mode enables the column headers by default. The columns seperated by a tab, which can be copied to csv/excel. We can switch back to grid mode after doing this.

Though this works, there is much more simpler approach which retains the grid mode as well as copy the column headers. No need of switching between modes.

On the SQL query analyzer menu>>>Query Options>>Results---Grid pane, please select the check box, for "Include Column headers when copying or saving the results". This option enables the setting to copy headers always.



Post #1011093
Posted Tuesday, October 26, 2010 1:41 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 6,748, Visits: 8,545
Thank you for sharing !

Many people didn't find this setting.

With sql2008 that option is included with the right-click on the grid.


Johan


Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #1011111
Posted Thursday, September 20, 2012 12:51 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 20, 2012 12:50 PM
Points: 1, Visits: 0
Perfect. Thanks!
Post #1362246
Posted Friday, September 21, 2012 7:05 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, November 5, 2014 11:16 AM
Points: 75, Visits: 622
Good tip...I always right clicked on the results pane and selected copy with headers.
Post #1362639
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse