Export Data from SQL Server To Flat File Using Import And Export Wizard

We have Import and Export Wizard in SQL, which can help to import or export data from various SSIS sources to different destinations using Wizard. In this example, we are going to export DimGeography table data present in the Adventure Works DW 2014 database to Geography text file present in the local hard drive.

Export Data from SQL Server To Flat File Using SSIS Import And Export

To Export Data from SQL Server To Flat File Using SSIS Import And Export Wizard, Double click on Import and Export Wizard tool, you can find in start -> All Programs. It will open the SQL Server Import and Export Data Wizard. The first page is a welcome page

Sql Server Import And Export Data Wizard 1

If you don’t want to see this page again, then Please tick the checkbox, “Do not show this starting page again.” For now, click Next

Choose a Data Source Page: This page is used to configure the source information. Our source is the SQL database, so we are selecting the Native Client as our source, and I am using my localhost instance as a server name.

Choose the Data source Connection 2

Select the source database from the list. Let us select the Adventure Works 2014 here.

Select the Database 3

Authentication: Here, we are using windows authentication. But in real-time, your organization or company will provide the authentication credentials to access the database. In that case, you have to change the radio button to server authentication and provide the user name and password.

Choose a Destination: This page is used to configure the destination information. Our target is to save the Export Data from SQL Server To Flat File Using SSIS Import And Export Wizard. So, we are selecting Flat File Destination as our Destination

Select the Flat File Destination 4

Then we have to choose the text file from our local drive

Choose the Flat File to Export Database table 5

From the above, you can observe we are creating the Geography text file. Next, Please select the Format we are going to use

Choose the Delimiter to Separate Columns 6

If you want the text file to include column name in the first row, then tick the checkbox “Column name in the first data row”. If not, uncheck it.

Click Next button

Specify Table Copy or Query: Here we have two options

  1. Copy data from one or more tables or views: Use this option to select from existing tables or view (All the columns data)
  2. Write a query to specify file data to transfer options: This is the option regularly use because there will be unnecessary columns in every table. So it is better to avoid them or selecting data with the condition.
Export Data from Sql Server To Flat File Using SSIS Import And Export Data Wizard 7

For the time being, we are selecting every row. So we chose the first option. Click Next button

This page is used to select the source table from the database you want to use as a source. Here we are choosing the DimGeography table. Click on the preview button to check the incoming data flow

Select the Database Table 8

Specify the Row delimiter and Column delimiter you wish to. Click on the Edit mappings button to change the types and sizes.

Column Mapping 9

Save and Run Package: This page gives us the option to save the package in either SQL server or File system. For the time being, I am selecting file system

Export Data from Sql Server To Flat File Using SSIS Import And Export Data Wizard 10

Save SSIS Package: Provide the address to save the package

Save the Package 11
  • Name: Change the package name as you wish
  • Description: Write your description
  • File Name: Select the file name by clicking on the Browse button and navigate to the appropriate location.

Click Next

Export Data from Sql Server To Flat File Using SSIS Import And Export Data Wizard 12

Click finish button to complete the SSIS Wizard. Observe the status: Success and Message.

Export Data from Sql Server To Flat File Using SSIS Import And Export Data Wizard 13

Let’s navigate to the file system address we provide and check for the file name Geography. Double click on a text document to check the result. We have successfully exported Data from SQL Server To Flat File Using SSIS Import And Export. wizard.

Export Data To Flat File Using Wizard 14