Selecting Nth Record in an SQL Query

后端 未结 12 946
悲&欢浪女
悲&欢浪女 2020-12-28 23:33

I have an SQL Query that i\'m running but I only want to select a specific row. For example lets say my query was:

Select * from Comments

L

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 00:03

    In SQL 2000 where you do not have ROW_NUMBER() function you could use a work-around like this:

    SELECT CommentsTableFieldList, IDENTITY(INT, 1,1) as seqNo 
    INTO #SeqComments 
    FROM Comments
    
    SELECT * FROM #SeqComments 
    WHERE seqNo = 8
    

提交回复
热议问题