>>>>>Not knowing much at all about SQL Server, I was wondering if there is a way to find a record for the next field value.
>>>>>
>>>>>Here is how I would do it in VFP:
>>>>>
>>>>>Say I have field ORDER_NO, I, 4
>>>>>
>>>>>Say I want to find a record after the record with ORDER_NO 100 (where I don't know if 101 exists):
>>>>>
>>>>>
>>>>>set near on
>>>>>seek 100 + 1
>>>>>
>>>>>
>>>>>How would you do that in SQL Server?
>>>>>
>>>>>Thank you.
>>>>>
>>>>>P.S. On a related subject, why in VFP SEEK respects SET NEAR ON and SEEK() does not?
>>>>
>>>>SELECT TOP 1 * FROM SQLTable WHERE ORDER_NO>100
>>>
>>>I thought that this could be the answer. But TOP (at least in VFP) is a fairly slow. I think it is due to the fact that SQL Select has to go through all records before finding the TOP so many. Does TOP work differently in SQL Server?
>>
>>That's correct. I'm not sure VFP9 still works that way, but that is the way it had to do it in the past. TOP works very differently in SQL Server.
>
>Thank you very much for your reply. I presume that when you say "differently in SQL Server," you mean it is much faster than in VFP (at least prior to VFP 9).
I can do that in a table with nearly 103 million rows nearly instantly in SQL Server (assuming the proper indexing).