Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save sql query result to excel? [closed]

How to save the sql query result from SQL Server 2008 R2 to Microsoft Excel 2008?

like image 244
Sohail Hameed Avatar asked Dec 20 '22 10:12

Sohail Hameed


1 Answers

The manual way, if your in SQL Server Management Studio (SSMS), is to just highlight the rows and columns and paste it in Excel or you can right-click and save as a CSV file and open it in Excel.

To bring over the headers, you want to:

  1. Click on the Tools menu option.
  2. Click on Options -> Query Results -> Sql Server -> Results to Grid
  3. Tick Include Column Headers when Copying or Saving the Results

Then do your copy and paste.

like image 100
Tuan Avatar answered Jan 04 '23 20:01

Tuan