Solved

MS SQL ROW Number

Posted on 1999-01-14
9
3,380 Views
Last Modified: 2010-05-18
In Oracle you can select row with clause <where rownumber = 2334>. How I can do the same in MS SQL? Do you know system veriables or function that return referenced ROW number?
0
Comment
Question by:aryaboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 

Author Comment

by:aryaboy
ID: 1092662
Edited text of question
0
 
LVL 7

Expert Comment

by:spiridonov
ID: 1092663
There is no ROWID functino in MSSQL, however you can try using IDENTITY column property to emulate such behavior.
0
 

Author Comment

by:aryaboy
ID: 1092664
I cannot find the answer!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:spiridonov
ID: 1092665
Any comments ? Why do you reject correct answer?
0
 
LVL 3

Accepted Solution

by:
gmoriak earned 200 total points
ID: 1092666
This SQL will simulate returning row numbers

select (select count(*)
        from table_x t2
        where t2.pk_id <= t1.pk_id) row_number, t1.*
from table_x t1

For the pk_id column , use the primary key column of the table (you can modify to use more than one if necessary)

0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1092667
[from thresher_shark]

This question appears to have become corrupted.

aryaboy - You may wish to post a new copy of this question.
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1092668
[from thresher_shark]

This question appears to have become corrupted.

aryaboy - You may wish to post a new copy of this question.
0
 
LVL 7

Expert Comment

by:spiridonov
ID: 1092669
No comments.
0
 
LVL 1

Expert Comment

by:wormzer
ID: 1092670
This question's now fixed.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Update the value of table B with value of table A tables inner join 6 78
Need SSIS project 2 30
Finding Where Clause Value in SQL Views and SP 21 43
Related to SQL Query 5 21
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question