开发者

How to return result set with incremented rows? [duplicate]

This question already has answers here: Closed开发者_如何学编程 11 years ago.

Possible Duplicate:

SQL Server ROW_NUMBER() on SQL Server 2000?

How do I return a row and an ascending counter as a result set?

The function Row_number() is not known in MS SQL 2000.


Create a variable table with an identity column and insert the results into it:

DECLARE TABLE @MYTABLE
(
    ID INT IDENTITY,
    VALUES......
)
INSERT INTO @MYTABLE
SELECT MYVALUES.....

SELECT * FROM @MYTABLE
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜