Pages

Search This Blog

Wednesday, November 14, 2007

MS SQL 2005: generate ID using ROW_NUMBER()

SELECT PVID, AuthorName, ROW_NUMBER() OVER(ORDER BY PVID DESC) AS ID WHERE ID BETWEEN 16 AND 20

PVIDAuthorNameID
34Mitchell16
65Sean17
73John18
90Mogan19
96Chang20

No comments: