Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 Integration Services
»
Delete files from different folders, approach...
Delete files from different folders, approach plz
Rate Topic
Display Mode
Topic Options
Author
Message
kishoremania
kishoremania
Posted Friday, August 17, 2012 2:28 PM
Valued Member
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:05 PM
Points: 52,
Visits: 158
Hi
I have a requirement that I need to implement delete logic before loading into it. I have around 10 excel files need to be loaded, each in different folder. Before that I need to delete those files from folders.
Can someone please tell me the logic in ssis.
Post #1346751
n79799
n79799
Posted Wednesday, August 22, 2012 9:37 AM
SSC Rookie
Group: General Forum Members
Last Login: Wednesday, March 13, 2013 10:30 PM
Points: 35,
Visits: 81
this should help......
If there are 10 different files each in different folder, I would suggest a script task with a C# script to delete a file and error out and fail the package(or howsoever you wan to design)
on error.
The other way could be :
Create a variable for path of folder....say src_path
Bring all your folders as resultset of a sql query....like
select 'c:\folder1' union select 'c:\folder2' union select 'c:\folder3'
Load it into a recordset destination(say the var rs)
Set Up a foreach Loop Container. Drive the iteration based on the rows contained in the recordset variable(look up help on ForeachLoop Container). Map the collection value on each iteration to the variable called src_path.
Set up a File System Task inside the loop container. Set The 'Operation' as 'Delete File'.
Drive the Source connection through a variable src_path
This way, upon completion of the loop, all your fiels ahould be deleted.
Hope this helps.
Post #1348520
kishoremania
kishoremania
Posted Wednesday, August 29, 2012 12:02 PM
Valued Member
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:05 PM
Points: 52,
Visits: 158
Thanks for your reply.
Can you please be in detail, how to lookup the recordset variable from foreachloop container.
Post #1351805
kishoremania
kishoremania
Posted Wednesday, August 29, 2012 12:02 PM
Valued Member
Group: General Forum Members
Last Login: Monday, January 28, 2013 2:05 PM
Points: 52,
Visits: 158
Can anyone please look into it
Post #1351806
Phil Parkin
Phil Parkin
Posted Wednesday, August 29, 2012 12:08 PM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Today @ 10:13 AM
Points: 4,227,
Visits: 9,460
kishoremania (8/29/2012)
Can anyone please look into it
Not until you prove that you have tried. There are plenty of resources available on the Internet for this fairly straightforward task. Come back and post again if you have specific questions. People here won't do your work for you - we're unpaid volunteers.
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
Post #1351809
Phil Parkin
Phil Parkin
Posted Wednesday, August 29, 2012 12:10 PM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Today @ 10:13 AM
Points: 4,227,
Visits: 9,460
I suggest that you search for something like "shredding a recordset in ssis".
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
Post #1351812
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.