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

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Variables holding filename

Author  Topic 

wali
Starting Member

7 Posts

Posted - 2007-02-08 : 11:45:58
I already posted this question in the Wrong Forum.

However I was wondering if it is possible to create a variable that holds the filename as an expression. I am using a For each loop to pick up files and i want to insert the 'Filename' as a colum so that i can differentiate among the rows in my destination Table.

Using the 'Derived Colum' in DTS I can link the colum to the variable. However i do not know how to create the variable which will store the filename for each file....

Any Clues...
Would really appreciate the help.....


nr
SQLTeam MVY

12543 Posts

Posted - 2007-02-08 : 14:56:41
In your for each loop you should be setting a variable to the filename then using that in the connection to import the file.
In the dataflow use a derived column table to add another column using that variable in the expression. This will then be available to output to the table.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

raclede
Posting Yak Master

180 Posts

Posted - 2007-02-13 : 20:03:41
For me I used the scripting function of SSIS then call a helper library to store the value of variables.
Go to Top of Page
   

- Advertisement -