• some remarks

    1. V11 (Azure) don't support OVER (ORDER BY) in Aggretates

    2. the NEXT VALUE with OVER is interesting things to play

    I'd like to persist current rank over order by some attribute. Unfortunately OVER isn't supported in UPDATE and MERGE. But there is workoround

    -- use NOrthwind -- :)

    -- /*

    create sequence nr as int start with 1

    -- */ alter sequence nr restart with 1

    go

    alter table products add x int

    go

    update products

    set x = t.n

    from products p

    join (select productid, next value for nr over (order by unitprice) n from products) T

    on p.productid = t.productid

    go

    select * from products

    go

    alter table products drop column x

    drop sequence nr

    with bests

    Henn