欢迎投稿

今日深度:

Execl数据导入SQL Server,execl数据导入sql

Execl数据导入SQL Server,execl数据导入sql


将execl表格 数据导入进数据库 可以指定列 也可以 *
注意:该语句只能在本地数据库执行 如果连接的是远程服务器 应到该服务器上执行语句

设置服务器全局配置 启用Ad Hoc Distributed Queries
该组件存在 安全隐患 所以默认是关闭

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

可以导入execl表格中指定列 到指定表中指定列

insert into 表名(字段名)     
select  字段名(跟上面对应)
from OpenDataSource('Microsoft.Ace.OLEDB.12.0','Data Source="c:\文档名.xls";Extended properties="Excel 12.0;HDR=Yes"')...[文档表名$]  go 

设置服务器全局配置 关闭Ad Hoc Distributed Queries

exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure

www.htsjk.Com true http://www.htsjk.com/shujukunews/8770.html NewsArticle Execl数据导入SQL Server,execl数据导入sql 将execl表格 数据导入进数据库 可以指定列 也可以 * 注意: 该语句只能在本地数据库执行 如果连接的是远程服务器 应到该服务器上执行语句 设置...
评论暂时关闭