下面的代码是将Excel中的表格导入DBF表,然后出现楼主表中的情况,请转换后看看效果如何:
SET DEFAULT TO SYS(5)+SYS(2003)
my_file=GETFILE("xls")
IMPORT FROM "&my_file" type XL5
my_dbf=JUSTSTEM(my_file)
SELECT (my_dbf)
FOR iii=1 to FCOUNT(my_dbf)
mzd=SUBSTR("ABCDEFGHIJKLMNOPQRSTUVWSYZ",iii,1)
mfilename=FIELD(mzd)
m_ren="ALTER TABLE "+ "&my_dbf rename column "+ mzd+" to "+ ALLTRIM(CHRTRAN(&mfilename," ",""))
&m_ren
NEXT
GO 1
DELETE
BROWSE