Open In App

How to Export Data to the .CSV File Using SQL Server Stored Procedure?

Last Updated : 26 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

CSV (Comma-separated values) is a file that consists of plain text data in which data is separated using comma(,). It is also known as Comma Delimited Files because comma act as a delimiter for CSV files.

Here we will see, the process of exporting Data to the .CSV file using the SQL Server Stored Procedure.

Step to Export Data to the .CSV File Using SQL Server Stored Procedure:

Step 1. In SQL Server Management Studio, interface with a data set you need to export a table from.
Step 2. Right-click the database and navigate to Tasks and then Export Data.

 

Step 3. In the SQL Server Import and Export Wizard window, click Next.

 

Step 4. Customize the data in the Choose a Data Source window: 

  • Select SQL Server Local Client 11.0 from the Data Source drop-down menu.
  • By default, the Server name and Data base fields contain appropriate data..
  • Select a necessary mode in the Authentication block.
  • After you have changed the information, the window will look as shown below.                                                                                                               
  • Then click Next.

 

Step 5. Modify the data in the Choose a Destination window: 

  • Select Flat File Destination from the Destination drop-down menu .
  • Enter the file name in the File Name field. To choose the file destination path, click Browse, select the path, and make the .csv file and click Next.

 

 
Step 6. Select a required choice in the Specify Table Copy or Query window and click Next.
 

 

Step 7. Select the table you need to export from the Source table or view drop-down menu from Configure Flat File Destination window and click Next.

 

Step 8. In the Save and Run Package window, click Next.

 

Step 9. Peruse the information in the Complete the Wizard window and click Finish.                                                                                                         

 

Step 10. After the export has gotten done, there will be the report. To save the report, you can click Report and select the ideal choice.
Step 11. At last, click Close.

 

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads