Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a variable in a select statement
Message
 
To
28/08/1997 18:04:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00047445
Message ID:
00047563
Views:
22
If you are only dealing with one table then you don't need to qualify the field. Surround the variable name with parentheses, creating a name expression:
SELECT * FROM table_name WHERE (VarFieldName) = VarFieldText
Some may suggest macro substitution, &VarFieldName, but name expressions are faster.

If you must qualify the table then try:
SELECT * FROM table_name WHERE ('table_name.' + VarFieldName) = VarFieldText
Be sure to include the period after the table name in quotes.

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform