

Then type bcp ? and press the Enter key in order to see if everything works as it should. To start export SQL data to CSV file, first open Command Prompt (cmd), go to start and type cmd and click on the Command Prompt item: With the bcp utility, a user can export data from an instance of SQL Server to a data file or import data from a data file to SQL Server tables. The bcp (bulk copy program) utility is used to copy data between SQL Server instance and data file. SQL Server Import and Export Wizard can be initiated without using SSMS, go to start and type word “Export”, from the search results choose 64-bit or 32-bit version of SQL Server Import and Export Wizard: On the image below, the ExportData.csv file in Excel and Notepad is shown with the exported data: In this case, the exporting process was finished successfully: The last window shows information about exporting process, was it successful or not. To data from SQL Server to CSV file, press the Finish button. The Complete Wizard window shows the list of choices that were made during of exporting process: Leave settings as they are and click the Next button: The Save and Run Package window will appear. If you are satisfied with the preview data, click the Next button in order to continue with exporting data. The Preview Data window will appear with data that will be exported: To view which data will be exported to the CSV file, click the Preview button. Under the Configure Flat File Destination window, choose the table or view from the Source table or view drop down box for exporting data to the CSV file: For this example, the Copy data from one or more tables or views radio button is chosen. On the Specify Table Copy or Query window, get all data from a table/view by choosing the Copy data from one or more tables or views radio button or to specify which data will be exported to the CSV file by writing an SQL query by choosing the Write a query to specify the data to transfer radio button.

In the File name box, specify a CSV file where the data from a SQL Server database will be exported and click the Next button:

Since the data from the SQL Server database will be exported to the CSV file under the Destination drop down box, select the Flat File Destination item. On the Choose a Destination window, specify a location for the data that will be copied from SQL Server. After everything is set, press the Next button: In the Authentication section, choose authentication for the data source connection and from the Database drop down box, select a database from which a data will be copied. In the Server name drop down box, select a SQL Server instance. In our case, under the Data source drop down box, select SQL Server Native Client 11.0. On the Choose a Data Source window choose the data source from which you want to copy data. The SQL Server Import and Export Wizard welcome window will be opened:Ĭlick the Next button to proceed with exporting data. From the Object Explorer, select a database, right click and from the context menu in the Tasks sub-menu, choose the Export Data option: Go to SQL Server Management Studio (SSMS) and connect to an SQL instance. One way to export SQL Server data to CSV is by using the SQL Server Import and Export Wizard. This article will cover the following methods:Įxport SQL Server data to CSV by using the SQL Server export wizardĮxport SQL Server data to CSV by using the bcp UtilityĮxport SQL Server data to CSV by using SQL Server Reporting Services (SSRS) in SQL Server Data Tools (SSDT) within Visual StudioĮxport SQL Server data to CSV by using the ApexSQL Complete Copy results as CSV optionĮxport SQL Server data to CSV by using SQL Server export wizard This article will explain different ways of exporting data from SQL Server to the CSV file.
