日期:2014-05-17 浏览次数:20588 次
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
go
SELECT * INTO spacefield
FROM OpenDataSource
('Microsoft.Jet.OLEDB.4.0','Data Source="D:\temp.xls";Extended properties="Excel 5.0;HDR=Yes;IMEX=1;"')...['sheet1$']
启用Ad Hoc Distributed Queries
--启用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 * INTO #tmp_asset
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\mswdata.xls', 'SELECT * FROM [sheet1$]') ;
select?*?FROM?OpenDataSource('Microsoft.ACE.OLEDB.12.0',?? ??
?'Data?Source=D:\test.xlsx,Extended?Properties="Excel?12.0;HDR=No;IMEX=1"'),'select * from sheet1'];??