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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 select records accordig to row id

Author  Topic 

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-09-04 : 02:21:21
Hi I have a Table VEHICLETRACK and data in it. I want to get data
according to rowid of each row like this

select * from VEHICLETRACK where rowid=1

How can i do it in SQL server 2000

Ranjeet Kumar Singh

jonasalbert20
Constraint Violating Yak Guru

300 Posts

Posted - 2006-09-04 : 02:22:54
have you used an identity column? you can utilized it if you want.

Want Philippines to become 1st World COuntry? Go for World War 3...
Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-09-04 : 02:25:58
no

Ranjeet Kumar Singh
Go to Top of Page

shaggy
Posting Yak Master

248 Posts

Posted - 2006-09-04 : 02:29:09
u can use timestamp

select * from VEHICLETRACK where timestamp =1
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-04 : 02:30:47
records are not stored in a table in any particular order. You determine how the sequence of records during retrieving using the ORDER BY.

select * from customer order by customer_name desc


So this means there isn't such things as first or last record in a table.

However there are some "work-around" to obtain the Nth record no. You can refer to this thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=71465



KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-04 : 02:31:02
You can also do this by ordering by other entity.

SELECT TOP 1 * FROM VehicleTrack ORDER BY SomeID_column.

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2006-09-04 : 02:45:32

Thanks My problem have solved

Ranjeet Kumar Singh
Go to Top of Page
   

- Advertisement -