(1)创建EXCEL文件c:/temp.xls
(2)执行查询
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=c:/temp.xls',sheet1$)
select * from tablename
同样在sql server中查询excel的记录
select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=c:/temp.xls',sheet1$)