首页 > 代码库 > OPENROWSET read excel

OPENROWSET read excel

由于64位系统已经不支持 oledb 4.0访问 xls

1. 未在本地计算机上注册“microsoft.ACE.oledb.12.0”提供程序

http://download.microsoft.com/download/7/0/3/703ffbcb-dc0c-4e19-b0da-1463960fdcdb/AccessDatabaseEngine.exe下载。

 

2.SQL Server blocked access to STATEMENT ‘OpenRowset/OpenDatasource‘ of component ‘Ad Hoc Distributed Queries‘ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘Ad Hoc Distributed Queries‘ by using sp_configure. For more information about enabling ‘Ad Hoc Distributed Queries‘, see "Surface Area Configuration" in SQL Server Books Online.

--打开 hoc distributed

exec sp_configure ‘show advanced options‘,1 
reconfigure 
exec sp_configure ‘Ad Hoc Distributed Queries‘,1 
reconfigure 

 

--关闭 ad hc distributed

exec sp_configure ‘Ad Hoc Distributed Queries‘,0 
reconfigure 
exec sp_configure ‘show advanced options‘,0 
reconfigure 

OPENROWSET read excel