>>>I have install SQLExpress2008 on a WS2003 with 2 Gb RAM (development machine)
>>>
>>>When I run a query against a table with 100.000 records from the Microsoft SQl Server Managent studio:
>>> [ Select top 1000 from sometable ]
>>>It returns the results in less than a second.
>>>
>>>But when I run the same query from VFP
>>> [ sqlexec(nHandle, "Select top 1000 from sometable ", "cur") ]
>>>It takes for ever, more than 15 seconds.
>>>What is the problem ?
>>
>>Where is your ORDER BY clause in the above statement? As far as I recall, TOP is not optimizable (I'll double check).
>
>Same performance WITH/WITHOUT order by clause
If you're using TOP clause you MUST specify ORDER BY. What is your SQL Server version? Check the message I pointed you too and Kevin Goff's suggestion - may be worth a try.
If it's not broken, fix it until it is.
My Blog