A Top 1 query, without an ORDER BY clause, will return the first row on the first page of the table. That row will not necessarily be the first row stored into the table.
For example, if table has a clustered index, the data is physically sorted in the order of the index and written to the correct page. Suppose the clustered index is on the EmployeeID column and the following rows are stored in the table.
EmployeeID TransCd TransDate
100021 1 9/17/01
100003 3 9/18/01
100020 2 9/19/01
100001 2 9/19/01
The physical order of the data will be as follows.
EmployeeID TransCd TransDate
100001 2 9/19/01
100003 3 9/18/01
100020 2 9/19/01
100021 1 9/17/01
Select Top 1 * From Table will retun the following.
100001 2 9/19/01
However, the first record entred on the table was
100021 1 9/17/01
We can see from this that Select Top 1 in MS SQL Server will not return the same result that Select First(ColumnName) returned in MS Access.
Now consider what happens if a new clustered index is chosen. The data will be physically reordered again, possibly resulting in yet another record being selected as Top 1.
The concept of FIRST and LAST are simply not part of the Relational model. SQL Server doesn't support the concept. One reason for is because data order can be readily changed as I've shown. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.