SQL Server reads data from Excel

Source: Internet
Author: User
Tags ole

The following is the execution of the SQL code, only take a simple read data examples, other detailed, please see for yourself

execsp_configure'Show advanced Options',1Reconfigureexecsp_configure'Ad Hoc Distributed Queries',1RECONFIGUREGOEXECMaster.dbo.sp_MSset_oledb_prop N'microsoft.ace.oledb.12.0'N'allowinprocess',1EXECMaster.dbo.sp_MSset_oledb_prop N'microsoft.ace.oledb.12.0'N'dynamicparameters',1GOSELECT * from OPENROWSET('microsoft.ace.oledb.12.0','Excel 12.0;database=c:\users\beige\desktop\sqltoexcel\data.xlsx;hdr=yes;imex=1', icd$)GoSELECT * from OPENROWSET('microsoft.ace.oledb.12.0','Excel 12.0;database=c:\users\beige\desktop\sqltoexcel\data.xlsx;hdr=yes;imex=1', cms$)GOexecsp_configure'Ad Hoc Distributed Queries',0Reconfigureexecsp_configure'Show advanced Options',0Reconfigure 

The OLE DB provider "microsoft.ace.oledb.12.0" was not registered when an error was performed.

This error requires installing the Accessdatabaseengine_x64.exe driver, select the appropriate version to download

: https://www.microsoft.com/zh-cn/download/details.aspx?id=13255

Also, it is important to note that the database executing the above SQL statement must be a local database,

Otherwise the error is

 Linked Server "(null )" OLE DB provider "Microsoft.ace.oledb.12.0  " error. The provider did not give any information about the error. Message  7303 , Level 16 , State 1 , section 1   row failed to initialize the linked server "(  null ) "OLE DB provider" Microsoft.ace.oledb.12.0 ". 

Here's how to summarize the solution:
1. Enable the OpenRowSet and OPENDATASOURCE functions in the SQL Server perimeter application Configurator
2, the database executing the above SQL statement must be a local database, if the remote database will report the above error
3. Link string Extended the contents of the Properties property are separated by semicolons and enclosed in double quotation marks, sheet1$ outside the parentheses.
4. Note that version 4.0 of office is office2003,12.0 is the office2007 version to see if the driver is installed.
5, the most critical is to see the SQL Server version number, is 32-bit or 64-bit. x64-bit SQL Server is not supported for many of the drivers of office.

SQL Server reads data from Excel

Related Article

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.