Updating the Execute SQL Task

New: 14 April 2006

In this task, you will update the SQL statement in the Execute SQL task named Preparation SQL Task. The existing SQL statement was automatically generated from the options you specified when you stepped through the SQL Server Import and Export Wizard pages to create the lesson 1 package. This SQL statement creates the ProspectiveCustomers table in the AdventureWorks database when the package is run.

Later in this lesson, you will generate an additional column to the data that is extracted from the Excel spreadsheet, and you need to include a definition of that column in the SQL statement.

To modify the SQL statement

  1. Click the Control Flow tab.

  2. Double-click Preparation SQL Task.

  3. On the General page, click the SQLStatement property, and then click the browse button (…).

  4. In the Enter SQL Query dialog box, add a comma at the end of the line, [Phone] nvarchar (50), press Enter, and on the new line, type [FullName] nvarchar (103).

    The completed SQL statement should look like this:

    CREATE TABLE [AdventureWorks].[dbo].[ProspectiveCustomers] (

    [FirstName] nvarchar(50),

    [MiddleInitial] nchar(1),

    [LastName] nvarchar(50),

    [BirthDate] datetime,

    [MaritalStatus] nchar(1),

    [Gender] nchar(1) NOT NULL,

    [EmailAddress] nvarchar(50),

    [YearlyIncome] money,

    [TotalChildren] tinyint,

    [NumberChildrenAtHome] tinyint,

    [Education] nvarchar(50),

    [Occupation] nvarchar(50),

    [HouseOwnerFlag] bit,

    [NumberCarsOwned] tinyint,

    [AddressLine1] nvarchar(60),

    [AddressLine2] nvarchar(60),

    [City] nvarchar(30),

    [State] nchar(3),

    [ZIP] nvarchar(10),

    [Phone] nvarchar(50),

    [FullName] nvarchar (103)

    )

    GO

  5. Click OK.

  6. Click Parse Query. The SQL statement should parse successfully.

  7. Click OK.

Next Task in Lesson

Adding and Configuring the Sort Transformation

See Also

Other Resources

Execute SQL Task
Transact-SQL Reference (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance