• Hi Lokesh Vij,

    thanks so much for your quick and HELPFUL answer. That´s right, that is exactly what I needed.

    In fact, I´m loading the final table using an SSIS DFT, I used a simplify version of my query in the original question, with this part of your query was enough:

    SELECT Receipt_key,

    Item_key,

    Row_number()

    OVER (

    partition BY Receipt_key

    ORDER BY Receipt_key, Item_Key) rnk

    FROM [My Transaction Table]

    The key point is the OVER statement, very useful, very handy.

    Thanks again for helping me to learn something new .

    Best Regards,

    Paul

    Paul Hernández