SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Passing a variable to a table
 New Topic  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  
 New 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.12 seconds. Powered By: Snitz Forums 2000