Click here to Skip to main content
16,013,581 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

How can I create the CSV file of a table records in SQL Server 2008R2.
Please suggests.

Thank you,

Regards,
Ashish
Posted

1 solution

Basic And Manual method is

From SQL Server Management Studio

1. Run a SELECT statement to filter your data
2. Click on the top-left corner to select all rows
3. Right-click to copy all the selected
4. Paste the copied content on Microsoft Excel
5. Save as CSV

Or you can refer this link to have advance methods

http://www.excel-sql-server.com/sql-server-export-to-excel-using-bcp-sqlcmd-csv.htm[^]
 
Share this answer
 
v2
Comments
Aashish vermaa 9-Sep-14 7:20am    
Not like this.

I want to write a sp where I pass the table name and could download the CSV file.
Gihan Liyanage 9-Sep-14 7:28am    
https://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900