Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSIS-get latest file from a group of files based on last modified date Expand / Collapse
Author
Message
Posted Wednesday, March 27, 2013 8:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, February 1, 2014 2:14 PM
Points: 100, Visits: 435
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
Post #1435928
Posted Wednesday, March 27, 2013 3:31 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, March 27, 2014 8:39 PM
Points: 18, Visits: 78
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.
Post #1436194
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse