• Hi Michael.

    Based on Jeff's reply, I no longer do the following:

    UPDATE #Part1

    SET @PaymentDueDate = PaymentDueDate WHERE ID = 1

    ----------------------------------

    I derive ID from:

    Create table #Part1

    (

    ID int identity(1,1)

    )

    *** I no longer use WHERE ID = 1, 2, 3, 4

    -----------------------------------

    Will test your suggestion:

    The function ADV_rptage is kind of over kill. Do a cross apply.

    CROSS APPLY [ADV_rptage](PaymentDueDate,@AgingDate) as Dates

    The select would then be:

    Dates.YEARS,

    Dates.Months,

    Dates.Days