Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Divide table monthwise
Message
De
22/02/2005 10:44:43
 
 
À
21/02/2005 11:57:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00988879
Message ID:
00989253
Vues:
16
>Dear Experts
>
>I have a table entitled "WEIGHTS", index on field "DATE"
>
>The date field has data as
>
>24/07/2004
>02/08/2004
>11/09/2004
>01/01/2005
>15/02/2005
>
>I want to divide this table into 12 tables, every table will hold data of a different month. For example the first table will be 072004.
>
>For this I wrote following codes
>
>FOR p_count = 1 TO 12
>    file_name = ALLTRIM(STR(p_count))
>       SELECT * FROM weights WHERE MONTH(date1) = p_count ; 
>       INTO TABLE d:\ahsan+(file_Name)
>NEXT
>CLOSE ALL
>
>But above codes retreive data of only last month as well as create one dbf instead of 12.
>
>Note: Index is on DATE field.
>
>Please help


What is the name of the one table that's created? Probably not creating a new name in the loop. I know it's not a great work around but I do something like:
cSQL = "SELECT * FROM weights WHERE MONTH(date1) = " ;
           + (p_count) ; 
           + " INTO TABLE d:\ahsan " + (file_Name)
?cSQL && to verify the statement is correct
&cSQL
HTH
Jim Philippi

quando omni flunkus moritati
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform