Select data from an Excel sheet in MSSQL
Select data from an Excel sheet in MSSQL
发布时间:2016-12-28 来源:查字典编辑
摘要:select*fromopenrowset('Microsoft.Jet.OLEDB.4.0','Excel8.0;HDR=YES;IMEX...

select*

fromopenrowset('Microsoft.Jet.OLEDB.4.0'

,'Excel8.0;HDR=YES;IMEX=1;DATABASE=d:folderexcel.xls',Sheet1$)

-------NOTE------

SettingIMEX=1tellsthedrivertouseImportmode.Inthisstate,theregistrysettingImportMixedTypes=Textwillbenoticed.Thisforcesmixeddatatobeconvertedtotext.Forthistoworkreliably,youmayalsohavetomodifytheregistrysetting,TypeGuessRows=8.TheISAMdriverbydefaultlooksatthefirsteightrowsandfromthatsamplingdeterminesthedatatype.Ifthiseightrowsamplingisallnumeric,thensettingIMEX=1willnotconvertthedefaultdatatypetoText;itwillremainnumeric.

YoumustbecarefulthatIMEX=1notbeusedindiscriminately.ThisisIMPORTmode,sotheresultsmaybeunpredictableifyoutrytodoappendsorupdatesofdatainthismode.

ThepossiblesettingsofIMEXare:

0isExportmode

1isImportmode

2isLinkedmode(fullupdatecapabilities)

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新数据库其他学习
热门数据库其他学习
编程开发子分类