Passing a variable to a table

  • Hi All

    I'm importing a number of tables with SSIS. I have a variable Filename used to select each individual file.

    I want to copy the value of this variable to a SQL table FilesImported each time a file is selected.

    I've added an execute SQL Task in the for loop container with the code

    INSERT INTO

    dbo.FilesImported

    SELECT

    + @[User::FileName]

    This isn't copying the value of the variable to the table.

    Any help would be appreciated.

  • andrew 82282 (2/13/2013)


    Hi All

    I'm importing a number of tables with SSIS. I have a variable Filename used to select each individual file.

    I want to copy the value of this variable to a SQL table FilesImported each time a file is selected.

    I've added an execute SQL Task in the for loop container with the code

    INSERT INTO

    dbo.FilesImported

    SELECT

    + @[User::FileName]

    This isn't copying the value of the variable to the table.

    Any help would be appreciated.

    That text cannot go into the SQLStatement field directly. You'll need to use an Expression. See the Expressions tab in the Execute SQL Task properties. Try setting the SqlStatementSource property to an Expression that looks like this:

    ="INSERT INTO dbo.FilesImported SELECT '" + @[User::FileName] + "';"

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply