SQLServer 查询 Excel

 

SELECT  *        
FROM    OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
                       'Data Source="E:\Project\Project Document\OJT\NameList\Namelist20134112.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...[NameList$]
WHERE   序号 IS NOT NULL 

SELECT  *        
FROM    OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0',
                       'Data Source="E:\Project\Project Document\OJT\NameList\Namelist20134112.xlsx";User ID=Admin;Password=;Extended properties=Excel 12.0')...[NameList$]
WHERE   序号 IS NOT NULL 

 如果4.0驱动用不了,可以尝试如下修改

management studio--->服务器对象-->链接服务器-->Microsoft.Jet.OLEDB.4.0-->右键属性-->访问接口选项:全都不选

posted @ 2013-05-03 11:04  IT-民工  阅读(195)  评论(0编辑  收藏  举报