• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

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.
0
brettr
Asked:
brettr
2 Solutions
 
É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

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now