开发者

Returning a result with incremented rows in MS SQL Server 2008

How do I return a row and an ascendi开发者_如何学JAVAng counter as a result set?


It depends on your RDMS, but there's probably a RANK or ROW_NUMBER function.


If its SQL Server you can do it with the following syntax:

SELECT     ROW_NUMBER() OVER (ORDER BY COLUMN_NAME) AS Id, column1, column2, ....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜