Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inlist function
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00656910
Message ID:
00656964
Views:
8
>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.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform