?
Solved

MS SQL ROW Number

Posted on 1999-01-14
9
Medium Priority
?
3,391 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 7

Expert Comment

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

Accepted Solution

by:
gmoriak earned 600 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

777 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