Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Divide table monthwise
Message
From
21/02/2005 12:58:02
 
 
To
21/02/2005 11:57:18
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00988879
Message ID:
00988905
Views:
30
>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
FOR p_count = 1 TO 12
    sMonth= LTRIM(STR(p_count))
       SELECT * FROM weights WHERE MONTH(date1) = &sMonth INTO TABLE (d:\ahsan+m.sMonth)
NEXT
CLOSE ALL
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform