Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not exists command
Message
 
 
À
19/04/2002 10:46:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00646918
Message ID:
00646925
Vues:
30
>Hey Everyone,
>I am trying to perform a command like :
>If not Exists(select field from database where anotherfield = this)
>
>Does Foxpro have an exists command that would allow me do this? I keep getting a "Function Name is Missing" error. Am I doing this wrong? Should I be using another command to perform this? Any help would be appreciated. Thanks.

In VFP you cannot use EXISTS outside of SQL Select. You can emulate it using following code
CREATE CURSOR dummy ( dummy c(1))
INSERT INTO dummy VALUES("*")
SELECT dummy FROM dummy WHERE EXISTS ( ;
		SELECT * FROM mytable WHERE field1 = somevalue) ;
	TO SCREEN NOCONSOLE
IF _TALLY = 0   && NOT EXISTS
  ...
ENDIF
If subquery returns not many records than even simplier.
SELECT field1 FROM mytable WHERE field1 = somevalue ;
	TO SCREEN NOCONSOLE
IF _TALLY = 0   && NOT EXISTS
  ...
ENDIF
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform