SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS-get latest file from a group of files based on last modified date


SSIS-get latest file from a group of files based on last modified date

Author
Message
var05
var05
Mr or Mrs. 500
Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)Mr or Mrs. 500 (553 reputation)

Group: General Forum Members
Points: 553 Visits: 437
Hi All,

I have a set of csv files that is being backed up in a folder on daily basis.

Say FOr eg:
File Modified Data
Country.csv 27/03/2013 09:00:01 AM
Geography.Csv 27/03/2013 09:00:01 AM
Product.csv 27/03/2013 09:00:02 AM
CUsomer.cSV 27/03/2013 09:00:02 AM
Country.csv 26/03/2013 09:00:02 AM
Geography.Csv 26/03/2013 09:00:02 AM
Product.csv 26/03/2013 09:00:01 AM
CUsomer.cSV 26/03/2013 09:00:01 AM
Country.csv 25/03/2013 09:00:02 AM
Geography.Csv 25/03/2013 09:00:03 AM
Product.csv 25/03/2013 09:00:01 AM
CUsomer.cSV 25/03/2013 09:00:01 AM

This way I have files backedup in the folder for 5 plus days...

I'll have four packages to pick up the data from Country, Geography,Product and Customer and load the same in to four different tables...I am able to write a script code to identify the latest file from the path...But I wanted to hardcode the filename some where in the package, so that particualr package will check for the latest file (say Cusomer), it will search for all the Customer files and pick up the latest and load into db.


Any help on this ?

Thanks!

I wanted to pick up the latest file from the folder and load the same into the database
devilsid
devilsid
SSC-Enthusiastic
SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)SSC-Enthusiastic (158 reputation)

Group: General Forum Members
Points: 158 Visits: 90
not sure if this is the exact outcome you were hoping for but i would declare a variable for the file name, use file system task to move the file to another directory after being loaded to a table, that way you could probably hardcode the first part of the name of the file to be picked up i.e. customer*.csv to be loaded to the relevant table.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search