In this article, we will learn how to export data from SQL to excel file.
Below is a selection from the “tblEmployees” table:
SELECT * FROM tblEmployees;
There are 2 ways to export data from SQL to Excel.
The one of the possible way to export data from SQL to excel file is a simple copy paste.
Firstly, run a Select query in the SQL Management Studio.
Now, right click on Results area and click on the Select All option (Ctrl + A).
Then again right click on Results area, and click on the Copy with Headers option (Ctrl + Shift + C).
Now, Open Microsoft Excel’s blank workbook.
Then right click on first cell, and click on the Paste option (Ctrl + V).
The other way to export data from SQL to excel is follow the same process as How To Import Excel In SQL Table, simple reverse the Source and the Destination. Earlier, the source was Excel and destination was SQL, now the source will be SQL and the destination will be Excel.
Also, check How To Get Second Highest Salary Using Query In SQL