我是靠谱客的博主 矮小秀发,最近开发中收集的这篇文章主要介绍Select data from an Excel sheet in MSSQL,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

select * 
from openrowset('Microsoft.Jet.OLEDB.4.0'
,'Excel 8.0;HDR=YES;IMEX=1;DATABASE=d:\folder\excel.xls',Sheet1$)

-------NOTE------
Setting IMEX=1 tells the driver to use Import mode. In this state, the registry setting ImportMixedTypes=Text will be noticed. This forces mixed data to be converted to text. For this to work reliably, you may also have to modify the registry setting, TypeGuessRows=8. The ISAM driver by default looks at the first eight rows and from that sampling determines the datatype. If this eight row sampling is all numeric, then setting IMEX=1 will not convert the default datatype to Text; it will remain numeric. 

You must be careful that IMEX=1 not be used indiscriminately. This is IMPORT mode, so the results may be unpredictable if you try to do appends or updates of data in this mode. 

The possible settings of IMEX are: 
0 is Export mode
1 is Import mode
2 is Linked mode (full update capabilities) 

最后

以上就是矮小秀发为你收集整理的Select data from an Excel sheet in MSSQL的全部内容,希望文章能够帮你解决Select data from an Excel sheet in MSSQL所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(161)

评论列表共有 0 条评论

立即
投稿
返回
顶部