Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any limit for Select-SQL's IN when using a list?
Message
From
04/10/2003 06:16:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/10/2003 14:03:39
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00834930
Message ID:
00835072
Views:
28
>I know that the VFP function INLIST() has a limitation of 24 items in its list.
>
>Does the SQL-Select IN (I1, I2, I3...) have any limit other than VFP's overall line length limit?
>
>Thanks

Jim,
AFAIK IN (...) has 24 limit (1 less than 25 inlist limit).
Even if it did pass the limit it'd be prone to hit command line length limit.
Whenever I need such a thing I create a cursor to hold inlist items and use that cursor for IN part. ie:

select .... where myField IN (select ... from tempCursor)
or :
select ..... from myTableA a inner join tempCursor b on a.item == b.item ...

ie:
LOCAL lcIDs,lnLines
local array arrIDs[1]
lcIds = ;
'10020,10028,10037,10041,10059,10070,10073,10075,10076,10077,'+;
'10096,10132,10140,10141,10147,10151,10152,10177,10178,10183,'+;
'10187,10189,10194,10196,10212,10228,10230,10243,10244,10265,'+;
'10277,10280,10295,10300,10307,10312,10313,10327,10339,10345,'+;
'10368,10379,10388,10392,10398,10404,10407,10414,10422,10457,'+;
'10462,10471,10478,10487,10502,10515,10516,10541,10552,10553,'+;
'10556,10561,10563,10583,10588,10595,10615,10620,10657,10663,'+;
'10669,10673,10676,10683,10686,10691,10727,10734,10737,10738,'+;
'10752,10780,10781,10787,10798,10805,10808,10810,10815,10819,'+;
'10832,10846,10858,10865,10912,10915,10919,10939,10949,10967,'+;
'10971,10982,10983,10985,10989,10990,10994,11000,11001,11005,'+;
'11009,11010,11013,11014,11015,11020,11028,11032,11035,11042'

CREATE CURSOR Idlist (order_id i)
lnLines = ALINES(arrIds, lcIds,.f.,',')
DIMENSION arrIDs[lnLines,1]
APPEND FROM ARRAY arrIDs

SELECT * from orders o ;
  INNER JOIN IDList il ;
  ON VAL(o.order_id) = il.order_id
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform