Go Back   CORTEX Forums > Local Happenings > CORTEX Blogs > BI Monkey
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Do? While / Until Loops in SSIS

This is a discussion on Do? While / Until Loops in SSIS within the BI Monkey forums, part of the CORTEX Blogs category; There isn’t an explicit Do.. While / Until loop in SSIS, but it is easy to emulate the functionality using a For Loop Container. It’s a simple 2 step process: ...


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 23rd July 2009, 10:30 PM   #1
Guru
 
Join Date: Jun 2009
Posts: 122
James Beresford is on a distinguished road
Thumbs up Do? While / Until Loops in SSIS

There isn’t an explicit Do.. While / Until loop in SSIS, but it is easy to emulate the functionality using a For Loop Container. It’s a simple 2 step process:
  1. Create a variable to hold your Until / While break value
  2. Set only the EvalExpression of the For Loop container to break when your condition is met in the variable
I’ve attached an example which uses the variable User::WhileCondition. The For Loop container stops executing when this EvalExpression is no longer true:
@[User::WhileCondition] < 5

The script task within the loop increases User::WhileCondition by 1 on each iteration. When it reaches 5, the loop stops executing.

The scenario I was using this was for monitoring a folder where files might keep arriving even during processing. So after the Foreach loop over the folder ran, the script task would check to see if any files remained in the folder. If there were, the loop would run again and process the new files. Once there were no files left, the Do.. Until loop evaluated that there were zero files and stopped running.

The sample package can be found here for 2005 and guidelines on use are here.



Get More from the original blog...
James Beresford is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing multiple characters in a Text String in SSIS James Beresford BI Monkey 0 30th June 2009 06:09 PM
Debugging SSIS ScriptTasks and ScriptComponents with Information Messages Darren Gosbell Random Procrastination 0 23rd June 2009 08:30 PM


All times are GMT +11. The time now is 10:07 AM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO