Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Passing a variable to a table
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

34 Posts

Posted - 02/13/2013 :  10:47:06  Show Profile  Reply with Quote
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

+ @[User::FileName]

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

Any help would be appreciated.

Posting Yak Master

160 Posts

Posted - 02/13/2013 :  13:29:53  Show Profile  Reply with Quote
Here is one option ..

SSIS - SQL Task >>

In Execute SQL Task Editor
General - SQLStatement ..


DECLARE @Fname varchar(50)

SET @Fname = ?    -- filename passed  to variable

INSERT INTO dbo.FilesImported

In Execute SQL Task Editor >>
Parameter Mapping ..

Add >>
Variable Name = User::FileName
Direction = Input
Data Type = VARCHAR
Parameter Name = 0
Parameter Size = -1

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000