Solved

MS SQL ROW Number

Posted on 1999-01-14
9
3,376 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft – Kerberos Configuration Manager. Delegation service account query 1 38
SQL, add where clause 5 24
sql server query 18 41
SQL Recursion schedule 13 18
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

831 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