Select data from an Excel sheet in MSSQL

所属分类: 数据库 / 数据库其它 阅读数: 138
收藏 0 赞 0 分享
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) 
更多精彩内容其他人还在看

ACCESS转SQLSERVER数据库的注意事项

Access承重量太低,当你考虑升级到SQL Server时,并不只是个连接字符串需要改变,需要改变的还有很多
收藏 0 赞 0 分享

数据库设计技巧[转]

数据库设计技巧[转]
收藏 0 赞 0 分享

iwms access与sql版的安装与转换

iwms access与sql版的安装与转换
收藏 0 赞 0 分享

[转载]让SQL运行得更快

笔者在工作实践中发现,不良的SQL往往来自于不恰当的索引设计、不充份的连接条件和不可优化的where子句。在对它们进行适当的优化后,其运行速度有了明显地提高!下面我将从这三个方面分别进行总结
收藏 0 赞 0 分享

[数据库] 通用分页存储过程第1/5页

[数据库] 通用分页存储过程
收藏 0 赞 0 分享

Access数据库升级为SQL数据库的注意事项和方法

Access数据库升级为SQL数据库的注意事项和方法
收藏 0 赞 0 分享

Win2003系统安装SQL Server2000后1433端口未开放的解释

这篇文章主要介绍了Win2003系统安装SQL Server2000后1433端口未开放的解释
收藏 0 赞 0 分享

SQL SERVER 与ACCESS、EXCEL的数据转换

SQL SERVER 与ACCESS、EXCEL的数据转换
收藏 0 赞 0 分享

Access转SqlServer的注意事项

Access转SqlServer的注意事项,需要的朋友可以参考下。
收藏 0 赞 0 分享

数据库的设计方法、规范与技巧

数据库的设计方法、规范与技巧
收藏 0 赞 0 分享
查看更多