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)
 Retrieving the last row from a table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-15 : 07:55:34
Raymond writes "I'm using sql server 2000.i want to be able to retrieve the last row from a table. The table's ID is of type uniqueidentifier.Can anyone please help me with a query i can use. Thanks."

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-15 : 08:02:32
What is your definition of 'last row' ?
Records are stored in table in no particular order. So there isn't a first row or last row.

Or is this what you want ?
select top 1 * from yourtable order by ID desc


----------------------------------
'KH'


Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2006-03-15 : 08:02:49
select top 1 * from mytable
order by idcolumn desc
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-15 : 08:05:37
Do you want something like this?
http://vyaskn.tripod.com/retrieve_guid_value_like_identity.htm

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -