Export headers with results

In SQL Server 2005, how can I export results along with headers?  For example, I open a table with a few rows.  I'd like to export those results along with headers?  Or based off of a select.
brettrAsked:
Who is Participating?
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sqlcmd is the right tool to do this:
http://msdn.microsoft.com/en-us/library/ms162773.aspx
the key parameters you want to use are:
-o <output file>
-h for the headers
-Q for the query or -i for the input script file

apart from those to specify connection parameters

also, a nice tutorial starts here:
http://technet.microsoft.com/en-us/library/ms170207.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.