sql语句:
SELECT * into sheet$
FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=C:\Documents and Settings\liurj\Desktop\temp\a.xls;User ID=Admin;Password=;Extended properties="Excel 8.0;HDR=Yes;";Persist Security Info=False')...[Sheet$]
或者
select * into sheet3$
from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 5.0;HDR=YES;DATABASE=C:\Documents and Settings\liurj\Desktop\temp\a.xls',[Sheet$])
导入excel到数据库中的一个表
错误提示:
Msg 15281, Level 16, State 1, Line 1
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
用sp_configure将'Ad Hoc Distributed Queries' 打开并设置
USE master
go
EXEC sp_configure 'Ad Hoc Distributed Queries',1
RECONFIGURE;
EXEC sp_configure;
错误提示:
Msg 15123, Level 16, State 1, Procedure sp_configure, Line 51
The configuration option 'Ad Hoc Distributed Queries' does not exist, or it may be an advanced option.
显示高级选项:
sp_configure 'show advanced options',1
RECONFIGURE WITH override
go
sp_configure 'Ad Hoc Distributed Queries',1
RECONFIGURE WITH override
go
这样在运行插入语句没有问题。OK
分享到:
相关推荐
直接使用SQL语句读取Excel表格内容,把表中内容导入数据库中
把Excel里的数据导入到数据库中,先拼接成sql,再依次执行。 It's just a demo.
在查询分析器中,直接用sql语句,把excel表中的数据导入到sqlserver数据库的相应表中
怎么写sql语句将Excel的数据插入到SQL Server数据库.doc
Excel数据导入到SQLserver数据库指定的表,可多页签,附sql语句
把Excel表中的数据导入sql service数据库的语句
通过EXCEL公式,拼接Oracle数据库插入语句。开发过程造数测试或导入初始化数据的时候很方便。
很实用的excel小工具!可以把excel表中的数据按照需要,生成SQL插入语句,从而直接导入到数据库表中。内部资料,不容易弄到哦。。
SQL语句导入导出大全 1.导出到excel 2.导入Excel 3.导入文本文件 4.导出文本文件 5.dBase IV文件 6.FoxPro 数据库 7.导出到DBF 8.导出到Access 等.......
基于C#实现将Excel的内容导出成sql语句,Excel的文件名作为导入的表名,Excel的列名为导入数据库表的字段名 使用方法 1.准备一个excel 文件名为到数据库的表名,内容为要生成的sql的数据; 2.启动软件 xls2sql.exe ...
将Excel生成SQL语句完成数据库导入.doc
SQL语句导入导出大全 /******* 导出到excel EXEC master..xp_cmdshell ’bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"GNETDATA/GNETDATA" -U"sa" -P""’ /*********** 导入Excel SELECT * .。...
将Excel数据相对应的导入数据库指定数据表内、或者新建表中,省去繁琐的SQL语句操作! 也可在线下载备份数据库数据
由于工作中需要写精算,给的一个Excel中,有大量数据需要写入数据库,一个个写,不知要到何年何月,于是使用Python,利用xlrd模块,解析Excel,将其中需要的数据生成想要的sql语句,根据sql语句插入到数据库,后续会...
如何把excel2016表格导入sql server2014中。先可以用向导导入测试,如果向导可以导入就可以用这个语句,如果向导导入报错,可以联系我。
在这个例子中,我们将使用windows验证连接到本地SQL Server实例,所使用的数据库将是ImportExcel。 在Specify Table Copy or Query(指定表复制或查询)向导界面中,选择copy data from one or more tables or ...
我们经常要使用到通过一条sql语句实现数据库的导入导出问题,比如说access的数据导出到EXCEL、txt或者SQLSERVER的数据库导到access等等。本人查过多方资料,进行了总结,自己也用过。个人觉得很有用
1.可以从Excel中导入数据到Sql中; 2.数据库不必是本地的,也可以是远程的(在登陆界面server这一栏中输入远程服务器的ip地址即可); 3.可以选择windows登陆,也可以用sql登陆; 4.详细可以参考帮助文档,(需要...
压缩包中有一个import_excel_data_to_mysql.exe的可执行文件,runtime_conf.txt运行时配置文件,配置文件中要修改数据库的连接信息以及指定执行的SQL语句,另外压缩包中也提供了一个测试SQL语句、demo.xlsx测试文件...