3 ms·
I don't believe that row_number() is standard, and I thought it couldn't be relied on for being monotonically increasing with inserts. It will also fail if you
by sanj 19y ago
I don't believe that row_number() is standard, and 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.
And, for me at least, cursors are definitely in the range of "advanced-ish" SQL.
My point isn't that it can't be done -- empirically, many blogs do it -- but that it points to part of the impedance mismatch.
- 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.