Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not exists command
Message
 
 
To
19/04/2002 10:46:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00646918
Message ID:
00646925
Views:
29
>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--
Previous
Reply
Map
View

Click here to load this message in the networking platform