>>If you're using SPT, then what's wrong with GO BOTTOM on the result cursor?
>>
>>>I'm using SPT with VFP cursors. I may take a look at using ADO. I just hate it cause JVP likes it!<vbg> (Just kidding JP if you're lurking.)
>
>I need the bottom row of a large table. I'm going to try getting the max(primarykey) route.
>
>Thanks,
Bottom in SQL Server terms is a relative term. SQL Server tables are physically ordered based on the a clustered index. If you have a clustered index on a date field, then the last row will be the highest date (assuming it is in ascending order), while the maximum PK may exist in the middle somewhere.
Depending on the order you want you can use the TOP keyword in your SQL statement.
select top 1 * from mytable order by mykey desc
This will give the maximum and it won't involve two queries. My way of thinking would be you would first have to retrieve the maximum key and then query again based on that key. This is done in one step.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao