3 ms·
> I don't believe that row_number() is standard Sure it is: see Section 6.10 of Part 2 of SQL:2003. > I thought it couldn't be relied on for being monotonical
by neilc 19y ago
> I don't believe that row_number() is standard
Sure it is: see Section 6.10 of Part 2 of SQL:2003.
> I thought it couldn't be relied on for being monotonically increasing with inserts. It will also fail if you need to use a date column that may not be ordered by time.
I think you are confused: ROW_NUMBER() is a window function, and as such is applied to an arbitrary query expression:
SELECT x, y, row_number() over (order by z) from t
And I would beg to differ that cursors fall into "advanced-ish" SQL :)
I don't see how it is an "impedance mismatch": transforming sets of data is the fundamental goal of SQL, and this seems to fall squarely within that domain.