Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1461
  • Last Modified:

what is substitution of ROWID and ROWNUM of Oracle in SQLServer

Hi ,
    usually in Oracle people uses ROWID and ROWNUM in Oracle.  I want to know what is the same we can use in SQL Server ?

 help would be appreciated

Regards
Sridhar.B
0
bethamsetty
Asked:
bethamsetty
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
ROWID:
  there is NO replacement (btw, ROWID is to be used carefully in Oracle)

ROWNUM:
  SQL Server 2005:
     you have a ROW_NUMBER() function

  SQL Server in general:
     when you want to get only the first x rows:
     SELECT TOP x ... FROM ... WHERE ...
0
 
bethamsettyAuthor Commented:
Hi,
   ROW_NUMBER() can be used for SQL Server 2005 not for 2000.  I want it for 2000 and another thing is TOP x.. is used to retrive top rows but if i want to retrieve a range then what is the option
    ex:
       I want to maintain paging in VB by using SQL Server 2000
         First user will view 100 rows next i want to  bring 100 to 200 rows...

Regards
Sridhar.B
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>but if i want to retrieve a range then what is the option
there is no really good option.

declare @t ( id int , rownumber int identity )

insert into  @t (id ) select top 200 id from yourtable  order by ...

select t.*
from yourtable t
join @t l
  on l.id = t.id
and l.rownumber >= 101

0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now