--启用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$)