>Hi
>
>I use a directory Tmp for all tables , that i get with
>Select ... into table .
>
>So , i whish that each table have a different name .
>
>How can i make this Select ?
>
>Select ... INTO Table SUBSTR(SYS(2015), 3, 10) ?
>
>And after , how can i select and use this table ?
>
>Thanks
Pedro,
You might use a cursor and give any name you want. Or with table you could use 'aliases' to keep track :
lcMyTable1 = sys(2015)
lcMyTable2 = sys(2015)
...
lcMyTableN = sys(2015)
Select ... INTO Table (lcMyTable1)
Select ... INTO Table (lcMyTable2)
...
Select ... INTO Table (lcMyTableN)
use (lcMyTable1) in 0 again alias 'myAlias1'
use in (lcMyTable1)
use (lcMyTable2) in 0 again alias 'myAlias2'
use in (lcMyTable2)
...
Since you now have 'known' aliases you don't need lcMyTableX variables to be scoped to other methods. At any time you could access the physical filename (drive:\path\lcMyTableX.dbf) from alias :
lcMyTable1 = dbf('myAlias1')
use in myAlias1
erase (lcMyTable1)
Cetin