>Hi all
>
>I want to do an SQL-select where a field should match a lot of ordernumbers like: SQLEXEC(nHandle,"select * from table where inlist(ordernr,'10507','11923','93172','88627','93821')","Query1")
>It can be 1-300 numbers in the list.
>The VFP function Inlist() works fine if I use it on a local table.
>The trouble is that it dont work in an SQL-select to a SQL2000 server.
>Are there any similar function I can use instead?
Create a cursor on the SQL side with the entries and then use the IN clause; if the cursor is named temp and the field in temp is orderno, your query would change to:
SQLEXEC(nHandle,"select * from table where ordernr IN (SELECT orderno FROM temp)
This is fully optimizable if temp has an index on orderno and a native Fox table is used.