sqlexec(han,"select cus_id into #temp from orders where 1 = 0") && would create a temp table on the server which would be droped when the connection closes or u drop it. ** Now populate this table sqlexec(han,"select * from #temp","temp") ** set buffering to table cursorsetprop("buffering",5,"temp") ** now populate the temp table created on the sqlserver with the cus_id which u have. select Customer && i think it is already open and contans the cus_id scan insert into temp values(customer.cus_id) endscan *******make this updatable cursorsetprop("tables","#temp","temp") cursorsetprop("UpdateNameList","cus_id #temp.cus_id","temp") cursorsetprop("UpdatableFieldList","cus_id","temp") cursorsetprop("KeyFieldlist","cus_id","temp") cursorsetprop("Sendupdates",.t.,"temp") tableupdate(2,.t.,"temp") ** use inner join to retrive the recordset sqlexec(han,"select orders.* from orders inner join "+; "#temp on orders.cus_id = #temp.cus_id","MYordercursor") sqlexec(han,"drop #temp") && drop the tableNow the Myordercursor contains the required results.
SQLExec(lnHandle, ; "select * from orders as rmtR"+; " inner join OPENROWSET('VFPOLEDB.1', "+; " '"+Sys(5)+Curdir()+"';'';'',"+; " 'select cus_id from customers') as locR"+; " on rmtR.cus_id = locR.cus_id",'Myordercursor' )