HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMajor

Save Results as CSV *with* headers in SSMS

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
ssmswithcsvsaveheadersresults

Problem

With SQL Server 2008 R2, when I save the results as a CSV there are no headers. I can work around this by copying and pasting with the "Copy with Headers" , or just grab the headers and paste them in the CSV etc, but is there a better way to do this?

Solution

In SSMS you need to change some options:

Tools - Options - Query results - sql server - results to grid (or text) -> Include column headers when copying or saving the results.

Changed settings are applied to new, but not existing query windows.

Context

StackExchange Database Administrators Q#3856, answer score: 30

Revisions (0)

No revisions yet.