Lesson 3: Running the Wizard to Export from ODBC to a Flat File
In this lesson, you run the SQL Server Import and Export Wizard to create the basic data transfer package. When you run the wizard, you make the following selections:
Specify the data source. You will use a SQL Server ODBC data source as the source and select rows in the table, Sales.SalesTerritory, in the AdventureWorks database.
Specify the destination. You will write the data to a text file. You will configure the text file by using the wizard.
After you run the wizard, you then rename the package. You rename packages to help make the packages self-documenting.
To run the SQL Server Import and Export Wizard
If it is not already open, in Business Intelligence Development Studio, open the Integration Services project that you created in the previous lesson.
In Solution Explorer, right-click the SSIS Packages folder, and then click SSIS Import and Export Wizard.
Note
If the Solution Explorer window is not open, on the View menu, click Solution Explorer.
On the Welcome page of the SQL Server Import and Export Wizard, click Next.
On the Choose a Data Source page, make the following selections:
For Data source, select .Net Framework Data Provider for Odbc.
For ConnectionString, type the following text:
Dsn=name of your SQL Server ODBC data source
On the Choose Destination page of the SQL Server Import and Export Wizard, make the following selections:
For Destination, select Flat File Destination.
Click Browse, navigate to C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\Exporting ODBC to Flat File\Sample Data, click the text file, FlatFile.txt, and then click Open.
For File name, make sure that this option is set to "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\Exporting ODBC to Flat File\Sample Data\FlatFile.txt".
For Locale, make sure that this option is set to English (United States).
For Code page, make sure that this option is set to 1252 (ANSI - Latin I).
For Format, make sure that this option is to Delimited.
On the Specify Table Copy or Query page of the SQL Server Import and Export Wizard, select Write a query to specify the data to transfer.
On the Provide a Source Query page, in the SQL statement box, type or copy the following SQL statement:
Select Sales.SalesTerritory.Name, Sales.SalesTerritory.CountryRegionCode, Sales.SalesTerritory.SalesYTD, Sales.SalesTerritory.SalesLastYear, Sales.SalesTerritory.CostYTD, Sales.SalesTerritory.CostLastYear FROM Sales.SalesTerritory
On the Configure Flat File Destination page, make the following selections:
For Source query, make sure that this option is set to "Query".
For Column delimiter, select Tab {t}.
On the Complete the Wizard page, review information about the new package, and then click Finish.
On the Performing Operations page, view the actions that the wizard performs, and then click Close.
When finished, the Status column for each action should display Success.
To rename the package
In Solution Explorer, in the SSIS Packages folder, right-click the new package, click Rename, and then type Export ODBC Lesson.
Make sure that the name includes the .dtsx extension.
If asked whether to rename the object, click Yes.
Next Lesson
Lesson 4: Testing the Lesson Package
|