--The following is a SQL statement that reads data from several common file formats directly in SQL
--/* text File
SELECT * FROM
OPENROWSET (' MICROSOFT. JET. oledb.4.0 '
, ' Text; Hdr=no;database=c: '--c: is the directory
, Aa#txt)--aa#txt is a text file name Aa.txt
--*/
--/* Excel File
SELECT * FROM
OPENROWSET (' MICROSOFT. JET. oledb.4.0 '
, ' Excel 8.0;imex=1; Hdr=yes;database=c:est.xls '--c:est.xls is an Excel file name
, sheet1$)
--/* DBase IV File
SELECT * FROM
OPENROWSET (' MICROSOFT. JET. oledb.4.0 '
, ' dBase iv;database=c: '--c: is the directory
, ' select * from [Customer profile 4.DBF] '--Customer profile 4.DBF is the file name
--*/
--/* DBase III File
SELECT * FROM
OPENROWSET (' MICROSOFT. JET. oledb.4.0 '
, ' DBase iii;database=c: '
, ' select * from [Customer profile 3.DBF] '
--*/
--/* FoxPro Database
SELECT * FROM OPENROWSET (' MSDASQL ',
' Driver=microsoft Visual FoxPro Driver; SOURCETYPE=DBF; Sourcedb=c: ',--c: Yes directory
' SELECT * FROM [AA. DBF] ')--aa.dbf is the file name
/*--Description:
SOURCEDB=C:C: is the storage directory for DBF files
[AA. DBF] is a DBF file name
--*/
--*/
SQL statements read data from several common file formats