I am using SQL Server Management Studio.
I wish to save the results of a query to an excel file.
I choose \"save as\" and then save to CSV file which I ca
The settings which has been advised to change in @Diego's accepted answer might be good if you want to set this option permanently for all future query sessions that you open within SQL Server Management Studio(SSMS). This is usually not the case. Also, changing this setting requires restarting SQL Server Management Studio (SSMS) application. This is again a 'not-so-nice' experience if you've many unsaved open query session windows and you are in the middle of some debugging.
SQL Server gives a much slick option of changing it on per session basis which is very quick, handy and convenient. I'm detailing the steps below using query options window:
Query Options...
at the bottom of the context menu as shown below:Results
> Grid
in the left navigation pane. Check the Include column headers when copying or saving the results
check box in right pane as shown below:That's it. Your current session will honour your settings with immediate effect without restarting SSMS. Also, this setting won't be propagated to any future session. Effectively changing this setting on a per session basis is much less noisy.