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
 Transact-SQL (2005)
 Help with Integration Services !!!

Author  Topic 

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2008-05-08 : 12:00:07
Hi All,

I have created an integration services project (attached is a screenshot) that workes against the flat file (.DAT extension) and it does some manipluation in the data and then load it into the table. Everything works fine.
Now I want to get the name of my flat file source fille (which is a .DAT file) and then insert it in the table.
I am running th integration services against different .DAT files (only one file at one time) which are located on different locations.....so what I want is that, whenever I run the package it do the usuall processing and then while loading the data in to the destination table, it also load the name of the file into the destination table (lets called a field "FileName" of nvarchar type in the table "Comphistory")

How can I achieve this?

I am looking for a quick and easy help.

Thanks,

Zee

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-08 : 12:05:12
quote:
Originally posted by zeeshan13

Hi All,

I have created an integration services project (attached is a screenshot) that workes against the flat file (.DAT extension) and it does some manipluation in the data and then load it into the table. Everything works fine.
Now I want to get the name of my flat file source fille (which is a .DAT file) and then insert it in the table.
I am running th integration services against different .DAT files (only one file at one time) which are located on different locations.....so what I want is that, whenever I run the package it do the usuall processing and then while loading the data in to the destination table, it also load the name of the file into the destination table (lets called a field "FileName" of nvarchar type in the table "Comphistory")

How can I achieve this?

I am looking for a quick and easy help.

Thanks,

Zee



Sorry i cant see the attachment
I think you need a ForEach loop container to achieve this. You can use ForEachFile Enumerator in this task and you can declare a variable in your SSIS package to hold the filename and can retrieve the value inside the For loop. And you can make use of derived column task to create a new column with value as that of variable created to the dataflow and You can use a SQL Command task to insert the data to your table or OLE destination.
Go to Top of Page

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2008-05-08 : 12:13:21
visakh16,
Unfortunalty I cannot attach anything here. This forum doesn't allow that.
Thanks..But I am really new in Integration Services, can you put some steps to follow....

Load of Thanks for your help
Zee
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-08 : 12:16:43
This link speaks of ForEach loop usage in similar scenario:-

http://www.sqlis.com/55.aspx
Go to Top of Page

zeeshan13
Constraint Violating Yak Guru

347 Posts

Posted - 2008-05-08 : 20:56:08
Thanks...I will look into this..
Go to Top of Page
   

- Advertisement -