FoxPro/in FOXPRO, how to combine many DBF's of the same structure to one table/query
Expert: Martha Granger - 6/20/2005
Questionsir,
i am learning foxprox (v2.6, for DOS), and i would like to combine 100 or more database (.DBF) files of having exactly the same field structures into one table or query. i tried QUERY but didnt came up. expect your answer at your convenience. this is for a project work that i am doing.
AnswerI will answer if you promise to never call me "sir" again, because I am not a man.
Since you have that many database files, it would be best to do this with a program, rather than at the command window.
Select one database as your main file, which all records of the others will be appended into. Place all of the other ones into their own directory. This directory should hold only those other databases, no other files.
USE mainfile
SET DEFAULT TO <pathAndDirectory>
=ADIR(laDBFs,'*.dbf')
FOR lnDBFcnt = 1 TO ALEN(laDBFs,1)
lcDBFname = laDBFs[lnDBFcnt,1]
APPEND FROM &lcDBFname
ENDFOR
RETURN