Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSMS Export Query Results to Excel or CSV

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?

like image 620
Joshua Wieczorek Avatar asked Aug 23 '17 21:08

Joshua Wieczorek


People also ask

How do I export query results from SSMS to Excel?

Launch SSMS and connect to the required database. 2. In Object Explorer, go to the database that you want to export to Excel. Invoke the shortcut menu and go to Tasks > Export Data.

How do I export SQL query results to Excel automatically in SQL Server?

Open SQL Server Management Studio and connect to the database. 2. Go to "Object Explorer", find the server database you want to export to Excel. Right-click on it and choose "Tasks" > "Export Data" to export table data in SQL.


1 Answers

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

like image 85
Vlad Avatar answered Sep 24 '22 15:09

Vlad