EXCEL数据导入SQL2008相关操作

1.
insert into tbProduct  (ID,UserID)     select  A,B   from
     OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source="D:\DLL\tbProduct.xls";Extended properties="Excel 4.0;HDR=Yes"')...[sheet1$]
go
2.
启用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

你可能感兴趣的:(Excel)