Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 rowid is there?

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-04 : 01:30:54
Hi experts,
I'm in need to use the rowid of a column.
is there any concept like rowid?

for example, i need the first row of a table.or 5th row of a table.how can i write the query?


thank you verymuch in advance.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-04 : 01:35:15
To get row no 5

use Northwind
select top 1 *
from
(
select top 5 *
from Customers
order by CustomerID
) d
order by CustomerID desc



KH

Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-04 : 01:51:10
Thank you very much
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2006-09-04 : 02:08:37
SQL Server does not have a ROWID like Oracle does. or if it does, it is not exposed to TSQL in the same way that Oracle exposes ROWID to PLSQL.

anyway, khtan's method will work, provided you have a unique or primary key in place that can be ordered (not a GUID for example).



-ec
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-04 : 03:41:14
Not in SQL 2000, no. But in SQL 2005 it does.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -