CLOSE DATABASES
USE D:\1\表2\表2 IN 0
SELECT 表2
sql_c=''
FOR i=1 TO FCOUNT()
LOCATE FOR NOT EMPTY(EVALUATE(FIELD(i)))
IF FOUND()
sql_c=sql_c+ALLTRIM(FIELD(i))+","
ENDIF
ENDFOR
IF NOT EMPTY(sql_c)
sql_c="select "+LEFT(sql_c,LEN(sql_c)-1)+" from 表2 into cursor 表2_tmp"
&sql_c.
SELECT 表2_tmp
m.out_filename=ALLTRIM(PUTFILE('','','xls'))
IF not empty(m.out_filename)
SELECT 表2_tmp
COPY to (m.out_filename) XLS &&导出excel
ENDIF
USE IN 表2_tmp
ENDIF
CLOSE DATABASES