Solved

MS SQL ROW Number

Posted on 1999-01-14
9
3,363 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
  • 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
 
LVL 7

Expert Comment

by:spiridonov
ID: 1092665
Any comments ? Why do you reject correct answer?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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 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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now