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)
 Record

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-05 : 07:58:54
Manoj writes "Dear friends,

Is there any builtin function to findout the last record of a table in TSQL of SQL SERVER.

Thanks!

manoj"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-05 : 08:17:56
There's no concept of "first" or "last" in a relational database. Rows are rows, regardless of where they appear in the table (or a SELECT statement with an ORDER BY clause)

Now, just to show why this is a meaningless term, when you say last row, do you mean the most recently inserted row, or the row that is physically stored after all the other rows, OR the most recently updated row?

Think of the game Musical Chairs; the same people circle around the same chairs and will sit in different chairs at different times. The people are the same, and the chairs are the same, only their ORDER changes, and changing their order doesn't change them; first and last doesn't mean anything in Musical Chairs either.

Go to Top of Page
   

- Advertisement -