How can I export data from table to excel with column name.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In SQL Server 2005, you can use SQL Server Integration Services (SSIS) to export data to Excel. Here’s an article that might get you started:
http://searchsqlserver.techtarget.com/generic/0,295582,sid87_gci1306800,00.html
On 2000, you can use Data Transformation Services (DTS). Using DTS to export data to Excel was much easier than doing it in SSIS, it’s too bad they made it more complicated in SSIS.
http://support.microsoft.com/kb/319951
There is also a simpler way to do it using OPENROWSET (this may require creating the Excel file before doing the export):
http://www.mssqltips.com/tip.asp?tip=1202
One additional simple way to do this is to just query your database by dumping the values into a comma-separated list, then saving off the results as a .csv file.
The simpler methods might require some clever coding to get the column names into the excel spreadsheet.