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)
相关文章
- Use excel Macro export data from database
- Select data from an Excel sheet in MSSQL
- C#使用Oledb读取Excel表格,使用select*from[表名] 不能读取到最后一列。跪求答案
- 工作总结 1 sql写法 insert into select from 2 vs中 obj文件和bin文件 3 npoi 模板copy CopySheet 最好先全部Copy完后 再根据生成sheet写数据 4 sheet.CopyRow(rowsindex, rowsindex + x); 5 npoi 复制模板如果出现单元格显示问题
- 急!!! 在线等~~~VBA怎么查询出Excel 的sheet中某列所有不重复的值, 就像 select distinct 一样的
- Transfer data to SQL Server from SPC-Light with Excel macros
- Mysql select * FROM table_one WHERE columns_one and columns_two in tables one and 2 have the same data [duplicate]
- how to use hlookup in Excel VBA with a range of data from another sheet?