SQL Server Management Studio – Export Query Results to Excel

The easiest way I’ve found involves two steps:


Adjust SSMS Settings



  1. Go to Tools->Options
  2. Query Results->SQL Server->Results to Grid
  3. Check “Include column headers when copying or saving results”
  4. Click OK.
  5. Note that the new settings won’t affect any existing Query tabs — you’ll need to open new ones and/or restart SSMS.

Now next time you run a query, do this



  1. Make sure the results are displayed in a grid (CTRL+D or Query->Results To->Results to Grid)
  2. Right click in the grid, and click Select All
  3. Right click in the grid again & click Copy
  4. Open up a new Excel spreadsheet, and paste the data in
  5. Do a global search & replace, replacing “NULL” with an empty string.

Voila!


I had tried before with SSMS’s export to CSV feature, and it just didn’t escape data the way I needed it to.

DevelopmentNow is a new media consulting company that specializes in building integrated mobile web solutions and native apps. For more information on mobile web technology and the services we offer, give us a call at 800.284.3961, or email sales@developmentnow.com.
This entry was posted in Database, Tools. Bookmark the permalink.

Comments are closed.

blog comments powered by Disqus