Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using variables in SELECT command
Message
De
07/07/1998 10:21:02
Mandy Mccord
Public Interest Breakthroughs, Inc.
Albany, New York, États-Unis
 
 
À
07/07/1998 10:01:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00114850
Message ID:
00114874
Vues:
10
>>Hi all,
>>
>>Quick question. I'm trying to scan through a bunch of my master tables to extract data for individual agencies. I'm scanning through my agency table to get "x", the current record's agency code, creating a subdir named "x" off of my "c:\mainwork\" directory to store that agency's data, then I scan through all my master tables to create new tables in my new "x" dir which only contain data for agency "x".
>>
>>I've got variable "x" for the name of a subdir and the code for my current record's agency in my agency table (eg. '00604'). I've got "y" for the current file name of a table I'm trying to copy and create from my tables file (eg. 'contacts').
>>
>>Now I'm trying to use a SELECT command to extract the data I need for each agency into their own directory. I'm trying the following, but getting errors. Anyone know what I'm doing wrong?
>>
>> SELECT * FROM &y INTO TABLE c:\mainwork\&x\&y WHERE acode=&x
>>
>>again, 'y'=my table name, 'x'=agency code/agency directory
>>
>>MTIA!!
>>
>>Mandy
>Hi Mandy,
>Instead of macrosubstitution use name expressions + do not use macro substitution but "x" itself in where expression (& further tries to refer a var named "00604").
myscanvalue = '00604'   && x
>mytablename = "contacts"
>select * from (mytablename) ;
> into table ("c:\mainwork\"+myscanvalue+"\"+mytablename) ;
> where ;
> acode = myscanvalue

Cetin

It worked like a charm. And I realized I also had to include an ALLTRIM() on my 'myscanvalue' since the path commands aren't too fond of trailing blanks ;). Thank you so much!

Mandy

Mandy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform