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 can open in excel. All good except I am missing column headers, any ideas how I get them exported?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Tools > Options > Query Results > SQL Server > Results to Text (or Grid if you want) > Include columns headers in the result set
You might have to close and reopen SSMS after changing this option.
Note: On the SQL Editor Toolbar, you can click Results to file (Refer screenshot) without having to restart SSMS.
Alternatively, you can also press Ctrl + Shift + F if you like keyboard shortcuts during development.