Select data from an Excel sheet in MSSQL

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Select data from an Excel sheet in MSSQL

  2021-03-18 我要评论
想了解Select data from an Excel sheet in MSSQL的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点: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) 

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们