SQL statements read data from several common file formats

Source: Internet
Author: User
Tags dbase

--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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.