Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select 1000 numbers that meet ...
Message
 
À
28/07/2003 12:22:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00813951
Message ID:
00814235
Vues:
10
PMBI, assuming that you mean a contiguous block of 1000 ids that have not been used, then maybe this will help
CREATE CURSOR idpool (id i, idused L)
LOCAL i,cntused

FOR i = 1 TO 20000
	INSERT INTO idpool (id, idused) VALUES(i,MOD(i,RAND()*100)=0)
ENDFOR

COUNT FOR idused TO cntused

?cntused
LOCATE FOR idused
lnblocktop=RECNO()
lnstartid=id
DO WHILE .t.
	CONTINUE
	IF RECNO()> lnblocktop+999
		?'Found Block of 1000 unused Ids starting with id #'+STR(lnstartid)
		EXIT
	ELSE
		lnblocktop=RECNO()
		lnstartid=id
	ENDIF
	IF EOF()
		?"No block of 1000 Unused Ids found."
		EXIT
	ENDIF
ENDDO
Tom

Life happens, don't blink.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform