Select data from an Excel sheet in MSSQL

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

在PostgreSQL的基础上创建一个MongoDB的副本的教程

这篇文章主要介绍了在PostgreSQL的基础上创建一个MongoDB的副本的教程,使在使用NoSQL的同时又能用到PostgreSQL中的东西,需要的朋友可以参考下
收藏 0 赞 0 分享

使用Bucardo5实现PostgreSQL的主数据库复制

这篇文章主要介绍了使用Bucardo5实现PostgreSQL的主数据库复制,作者基于AWS给出演示,需要的朋友可以参考下
收藏 0 赞 0 分享

详细讲解PostgreSQL中的全文搜索的用法

这篇文章详细介绍了的PostgreSQL中的全文搜索的用法,包括对全文搜索的一些优化的实现,需要的朋友可以参考下
收藏 0 赞 0 分享

介绍PostgreSQL中的jsonb数据类型

这篇文章主要介绍了介绍PostgreSQL中的jsonb数据类型,jsonb是PostgreSQL9.4中开始内置的类型,能够支持GIN索引,需要的朋友可以参考下
收藏 0 赞 0 分享

介绍PostgreSQL中的Lateral类型

这篇文章主要介绍了介绍PostgreSQL中的Lateral类型,Lateral是PostgreSQL9.3版本以来加入的内置类型,需要的朋友可以参考下
收藏 0 赞 0 分享

mysql、mssql及oracle分页查询方法详解

这篇文章主要介绍了mysql、mssql及oracle分页查询方法,实例分析了数据库分页的实现技巧,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享

telnet连接操作memcache服务器详解

这篇文章主要介绍了telnet连接操作memcache服务器详解,本文讲解了连接、添加修改、读取、删除、清空所有缓存等操作命令,需要的朋友可以参考下
收藏 0 赞 0 分享

SQL语句实现删除重复记录并只保留一条

这篇文章主要介绍了SQL语句实现删除重复记录并只保留一条,本文直接给出实现代码,并给出多种查询重复记录的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

50条SQL查询技巧、查询语句示例

这篇文章主要介绍了50条SQL查询技巧、查询语句示例,本文以学生表、课程表、成绩表、教师表为例,讲解不同需求下的SQL语句写法,需要的朋友可以参考下
收藏 0 赞 0 分享

SQL查询出表、存储过程、触发器的创建时间和最后修改时间示例

这篇文章主要介绍了SQL查询出表、存储过程、触发器的创建时间和最后修改时间示例,本文直接给出代码实例,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多