--启用Ad Hoc Distributed Queries:
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
--使用完成后,关闭Ad Hoc Distributed Queries:
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
--select max(infoid) from 库.hy_unitinfo
INSERT INTO hy_unitinfo(unitNmae,orgCode,QualLevel,QualCertNo,unitType,infoId)
SELECT unitNmae,orgCode,QualLevel,QualCertNo,unitType,infoId
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;HDR=YES;DATABASE=c:\lw.xlsx',Sheet1$)
本文介绍如何通过SQL Server配置AdHocDistributedQueries参数来启用和禁用Ad Hoc分布式查询,并提供了一个从Excel文件中读取数据并插入到SQL Server数据库的具体示例。
803

被折叠的 条评论
为什么被折叠?



