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

Importing in ssis when a file is of a certain size Expand / Collapse
Author
Message
Posted Thursday, April 25, 2013 9:30 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, May 1, 2013 1:44 AM
Points: 34, Visits: 211
Hi All,
I am creating packages that import xml files.
however I want to import files that are more than 213kb in size. I have a fore each container which picks up the files.
Is there any way in ssis to check for the file size before importing?
Any help will be highly appreciated
Thanks
Yarhad
Post #1446571
Posted Thursday, April 25, 2013 9:52 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Saturday, December 20, 2014 10:05 PM
Points: 1,708, Visits: 2,272
Finding out the file size isn't difficult, but the real question is why the size matters. What do you intend to do differently if the size is 512KB instead of 213KB, and why? If you have a For Each loop in place, will you need to check each file before processing it?


Steve
(aka sgmunson)

Internet ATM Machine
Post #1446584
Posted Friday, April 26, 2013 10:08 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, May 1, 2013 1:44 AM
Points: 34, Visits: 211
Thanks steve for your reply.
the situation is this...
I have xml files that I import everyday and when the file size is say 1kb,
the file structure doesn't match the destination table because the file is empty of data.
but when it is say 245 or even 16kb in size then it has data and hence the file structure matches the destination table.
I am just looking for a way to ignore the files that have a size of 1kb. something like that
Thanks
Yarhad
Post #1447080
Posted Friday, April 26, 2013 10:10 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, May 1, 2013 1:44 AM
Points: 34, Visits: 211
Hi Steve
Sorry, and yes if I have a for each loop container, I will need to check each file before I process it
thanks Yarhad
Post #1447082
Posted Thursday, May 9, 2013 9:29 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 31, 2014 7:20 AM
Points: 18, Visits: 97
Within a container I use a script task to verify the file
eg.

Dim FileInf As FileInfo

FileInf = New FileInfo(Dts.Variables("User::FullFileName").Value.ToString())

Dts.Variables("User::FileSize").Value = CInt(FileInf.Length)

and then depending on the filesize set a status flag, which I then use a precedence constraint outside of the script to select the component output flow as per diagram.



  Post Attachments 
Precedence1.jpg (3 views, 41.20 KB)
Container.jpg (3 views, 26.72 KB)
Post #1451194
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse