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.
Who is Participating?
Éric MoreauSenior .Net ConsultantCommented:
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sqlcmd is the right tool to do this:
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:
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.