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

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Excel file iteration using For each loop container
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gangadhara.ms
Aged Yak Warrior

India
502 Posts

Posted - 11/03/2009 :  02:48:45  Show Profile  Visit gangadhara.ms's Homepage  Reply with Quote
Dear All,
I am using the For each loop container to loop through all the excel sheets.Its working fine for me.
The issue is with lets say there are 3 files are there in the folder.
During package design i have given the default following expression:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @[User::FileName] + ";Extended Properties=\"Excel 8.0;HDR=YES\";"
In the excel path proporties ->Excel file path i have given the exact file name i.e..E:\SampleExcelFiles\Excel to upload.xls

If i change the above file name to other file name its not working.Its through an error saying that invalid source connection manager.

If anybody face the same issue,please help.

Thanks in advance,
Gangadhar

yosiasz
Flowing Fount of Yak Knowledge

USA
1610 Posts

Posted - 11/03/2009 :  11:43:42  Show Profile  Click to see yosiasz's MSN Messenger address  Reply with Quote
what is the value of @[User::FileName] and how are you assigning it? also why are you changing the file name again?

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

India
502 Posts

Posted - 11/04/2009 :  02:22:02  Show Profile  Visit gangadhara.ms's Homepage  Reply with Quote
Well..I am assigning the @[User::FileName] in the package variable and it contains the .xls file name.
I want to change the filename due to this package will run on monthly basis.so every month the file name vary like 20091001details.xls and in the next month it will change to 20091101details.xls and so on.
The above logic is working for other Excel sheet file name change,but for initial variable stored value it is not working.
Pls help how to do the iteration through the list of files with the name changing.

Thanks In advance,
Gangadhar
Go to Top of Page

yosiasz
Flowing Fount of Yak Knowledge

USA
1610 Posts

Posted - 11/04/2009 :  11:25:00  Show Profile  Click to see yosiasz's MSN Messenger address  Reply with Quote
do something like this then

CONVERT(CHAR(10), GETDATE() , 121) to get 2009-11-04. Then in the property of the for each loop go to variable mappings and work your stuff out there.

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

India
502 Posts

Posted - 11/06/2009 :  11:11:34  Show Profile  Visit gangadhara.ms's Homepage  Reply with Quote
Hi, My problem is with the input source file name.
i need to give the different file name when the package gets executed next time.

Pls guide.
The filename may change to other as well..its not only with date with other text name also.
Go to Top of Page

AustraliaDBA
Starting Member

29 Posts

Posted - 05/09/2012 :  00:56:39  Show Profile  Reply with Quote
did u resolve the problem. could u please share your solution. i have same problem and couldn't figure out how to fix it

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
48076 Posts

Posted - 05/09/2012 :  22:41:44  Show Profile  Reply with Quote
quote:
Originally posted by gangadhara.ms

Hi, My problem is with the input source file name.
i need to give the different file name when the package gets executed next time.

Pls guide.
The filename may change to other as well..its not only with date with other text name also.


but input files are in a folder and is processed by for each loop right? Then you will be getting new filename itself inside variable right? or are you trying to search for latest file among ones present in folder based on date value?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
48076 Posts

Posted - 05/09/2012 :  22:42:18  Show Profile  Reply with Quote
quote:
Originally posted by AustraliaDBA

did u resolve the problem. could u please share your solution. i have same problem and couldn't figure out how to fix it

Thanks


I have answered in your thread
hope thats what you're looking at

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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.08 seconds. Powered By: Snitz Forums 2000