Extracting Field Titles - newbie question....

  • Thread starter Thread starter WhytheQ
  • Start date Start date
W

WhytheQ

I'm new to SQL Server and am mainly writing simple SQL then copying the
results into Excel and then messing around with it.

At present, once the query has run I go to the result grid and right
click on the top left cell and then do Select All and then open an
Excel file and paste into the worksheet: this moves the data fine.

The problem is that it doesn't move the field headings of the data, so
I have to manually type these in Excel: is there an easy way to move
the field headings?

Any help greatly appreciated,
Jason.
 
I'm not sure where you're right-clicking on the top-left cell and doing
"Select All", as I don't see that option either in SQL Server or in Access.
My experiments in Access seem to always copy the column names, however, so
I'll assume you're working in SQL Server, and maybe have a different version
than I do.

To copy the column names from SQL Server, instead of selecting the entire
grid, select all of the columns by clicking on the first column-heading,
then dragging your mouse over to the last column-heading. Then do your copy
& paste as normal. This has the advantage of copying all the
column-headings, but the (usually negligible) disadvantage of always copying
the extra blank row at the end of the recordset.


Rob
 
Back
Top