For loop with expression for counter

  • Hi,

    Since couple of days I am trying to resolve this SSIS issue but got failed. Please help me. I have a for loop in my maintenance package which should depend on a value comes from a query.

    Query:

    select count(*) from(Select CA.biAddressId, C.biCustomerId, C.vchCustomerFirstName, C.vchCustomerLastName

    From ActiveCustomer C

    join ActiveCustomerAddress CA ON C.biCustomerId=CA.biCustomerId join (select distinct biAddressId from (select ROW_NUMBER() OVER (partition by biAddressId, vchCustomerLastName order by biAddressId) AS 'RowNumber', biAddressId, C.biCustomerId, C.vchCustomerFirstName, C.vchCustomerLastName from ActiveCustomerAddress CA INNER JOIN ActiveCustomer C ON C.biCustomerID=CA.biCustomerId) A where A.RowNumber>1) SubA

    ON SubA.biAddressId=CA.biAddressId) expr

    I am saving this in a package variable called 'LoopLimit'. My for loop should run depending on this value so I have tried to take the counter (called 'counterloop') as below:

    InitExpression: @counterloop=(DT_UI4)@LoopLimit

    EvalExpression: @counterloop>0

    AssignExpression: @counterloop=@counterloop - 1

    But its not allowing me. Please help me in this.

  • What is the error?

    Try == instead of =

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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