>Hi Borislav
>
>>If you SCAN through relatively small ammount of records maybe the difference in speed will not be visible, if you have many ecords in SCAN I expect this to be faster because your query is compiled at SQL Server side and SQL Query optimizer is already done its job and after you issue SQLEXEC() its just follow the execution plan. But as I said this is only my expectations.
>
>Thanks a lot for the idea. I will definately give it a try.
You can do another way
prepare an indexed result cursor with CREATE CURSOR
SCAN spt cursor
Build a select clause with IN ( primary keys ) based on source spt cursor
if n records
SQLEXEC()
insert into result from spt cursor
reset SQL Command
ENDSCAN
then
SCAN
SEEK result cursor
do stuff
ENDSCAN
If you already know record range, I think that it will be faster to get both cursors first