从FoxPro数据库中提取结构/索引到Excel

发布时间 2023-09-15 14:13:48作者: lzlvv

 

有一个数据上传程序和几个工具,用于从Visual中当前选择的别名创建MySQL创建表脚本。

或者,如果您想手动执行Excel路径,那么.

如果您有一个具有以下结构的表MYTABLE.DBF:

Structure for table:          C:\TEMP\MYTABLE.DBF
Number of data records:       0       
Date of last update:          01/05/2014
Code Page:                    1252    
 Field  Field Name            Type                        Width      Dec    Index   Collate     Nulls       Next       Step
     1  FIRSTNAME             Character                      20                                    No
     2  LASTNAME              Character                      20                                    No
     3  AGE                   Numeric                         3                                    No
     4  ID                    Integer (AutoInc)               4               Asc   Machine        No          1          1
** Total **                                                  48

然后,您可以通过VFP命令窗口将结构转储到另一个DBF,如下所示:

cd \temp
use mytable
copy structure extended to mytablestruct.dbf

然后,可以打开包含结构信息的表,并将其转储为XLS格式:

use mytablestruct
copy to struct.xls type xl5

在Excel中,如下所示:

对于索引,您必须编写这样的一个小例程:

    Create Cursor indexinfo (idxname C(254), idxtype c(254), idxkey c(254), ;
        idxfilter c(254), idxorder c(254), idxcoll c(254))
    Use mytable In 0
    Select mytable
    lnTags = ATagInfo(laTemp)
    For i = 1 to lnTags
        Insert into indexinfo values (laTemp[i, 1], laTemp[i, 2], laTemp[i, 3], laTemp[i, 4], laTemp[i, 5], laTemp[i, 6])
    EndFor
    Select indexinfo
    Copy To indexinfo.xls type xl5

打开结果的indexinfo.xls: