Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Importing in ssis when a file is of a certain size


Importing in ssis when a file is of a certain size

Author
Message
YarHad
YarHad
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
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
sgmunson
sgmunson
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2867 Visits: 3775
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)
Smile Smile Smile
Health & Nutrition
YarHad
YarHad
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
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
YarHad
YarHad
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
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
Sid Seton
Sid Seton
Grasshopper
Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)Grasshopper (20 reputation)

Group: General Forum Members
Points: 20 Visits: 102
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.
Attachments
Precedence1.jpg (3 views, 41.00 KB)
Container.jpg (3 views, 26.00 KB)
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