SSMS Export Query Results to Excel or CSV

Joshua Wieczorek picture Joshua Wieczorek · Aug 23, 2017 · Viewed 10.6k times · Source

I am trying to export the results of a query to CSV and then ultimately Excel.

My issue is, one of my columns has commas in it and the commas interrupt Excel parsing the CSV in the correct places.

I don't have write privileges to the db, so dropping the query results into a table and then exporting that table to excel is not an option.

Is there a way to export to excel, or at least CSV with a column that has commas in it?

Answer

Vlad picture Vlad · Aug 24, 2017

1 Right click your DB in object explorer window, go to Tasks -> Export Data

2 Pick Sql Server native client as your source, put in your connection parameters

3 Pick Excel as your destination

4 On the next screen paste your select query

5 go through the remaining screens making sure things look correct

6 profit