For Loop inside Foreach Loop

  • I have a process that I want to get a list of tables from a SQL task and for each table perform a For Loop. Once the For Loop finishes I would like for the next table to start. I have everything configured and it works for the first table, but when the For Loop (The inner most task) finishes it completes the packages instead of going to the next table inside the Foreach loop. I have confirmed that the Foreach Loop is working correctly (script task to report the table and I get the 5 I expect). Any help would be greatly appreciated.



    Microsoft Certified Master - SQL Server 2008
    Follow me on twitter: @keith_tate

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Hi Keith

    One of my packages also process some tasks on a list of tables, it works fine.

    I have declared 3 variables:

    TblList as object

    TblId as Int16

    TblName as string

    Query statement select row_number() over (order by object_id asc) as id,name from sys.tables where type = 'U' from SQL task stores result set in TbLList variable.

    Foreach Loop Container do iteration on Foreach ADO Enumerator (User::TblList) and maps values to User::TblId And User::TblName,

    then inner For Loop starts and do some jobs with table, when finish returs to extrenal (Foreach Loop).

    Br.

    Mike

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply