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)
 Importing files with different extensions

Author  Topic 

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2008-04-25 : 12:16:25
Hi i've 6 files with the same name part but all have a different ext. The 17 always changes to the current week number

xbouns.A17
xbouns.B17
xbouns.C17

I want to import these files into a database table. So I've create a foreach loop and select the foreach file enumerater but am not sure if this is the right way to go about it some help woth be great thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-25 : 13:03:24
Yup. Only thing is you need a variable to hold the file name and evaluate it as expression to get the names. Map this variable to file name property in the foreach enumerator task dynamic property.
Go to Top of Page

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2008-04-28 : 05:06:46
Hey i think am going to need a bit more help i've created my variable. But am not to sure on how to evaluate it as expression do i use the find string ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-28 : 05:11:07
You have properties table for yourvariable. Select your variable click properties icon on top to view properties window. Change evaluate as expression property to True and ciclk on Expression property to open Expression builder window. Enter your expression and click evaluate expression to check if its valid. Then save it and close.You can then use this variable to set filename property.
Go to Top of Page

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2008-04-28 : 05:25:06
Thats fine regards the variable. I've create my variable and i also create an expression but the tricky thing here is that my expression must be on the extension part of the file extension

i know the file name is xxxxxxxxxx.X18
Where the name of the file is static and the first part of the extension is also static but the last part of the extension will always change
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-29 : 05:18:23
Will the extensions be start be always same i.e A,B,C
Go to Top of Page

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2008-04-29 : 05:47:43
yes the first letter of the extension will always be the same.
example xxxxxx.A18 next week it will be xxxxxx.A19 xxxxxx.A20 etc..
the numbers 18 , 19 , 20 are week numbers.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-29 : 06:19:16
Ok then hardcode first part and append the number from date of execution of package ( i think that is what it designates)
Go to Top of Page
   

- Advertisement -