使用SQL 脚本 导入 Excel 数据
2011-11-23 21:19
316 查看
一、导入到 Mysql 数据库 先将excel 文件另存为 *.csv 文件,然后执行下列命令。
load data local infile "path.csv" into talble(col1,col2,col3,col4,...);
二、导入Sql Server 数据库
首先需要开户 Ad Hoc Distributed Queries 选项,开户方法如下:
exec sp_configure 'show advanced options',1 reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
然后执行:
SELECT * into newtable
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="F:\一页管理.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...[Sheet1$]
最后关闭 Ad Hoc Distributed Queries 选项
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0reconfigure
load data local infile "path.csv" into talble(col1,col2,col3,col4,...);
二、导入Sql Server 数据库
首先需要开户 Ad Hoc Distributed Queries 选项,开户方法如下:
exec sp_configure 'show advanced options',1 reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
然后执行:
SELECT * into newtable
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="F:\一页管理.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...[Sheet1$]
最后关闭 Ad Hoc Distributed Queries 选项
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0reconfigure
相关文章推荐
- 对Excel进行数据导入,函数拼写Sql脚本,动态生成一列单元格函数
- 使用sql语句导入/导出 数据为Excel
- 使EXCEL中使用宏生成T-SQL实现数据导入
- 使用navicat for sqlserver 把excel中的数据导入到sqlserver数据库
- Sql 脚本导入EXCEL数据
- 使用PL/SQLDeveloper把excel数据导入到数据库
- 利用SQL脚本向数据库导入EXCEL中的数据
- 如何使用PL/SQL工具将excel中数据导入oracle库
- 使用sqlplus导入sql脚本,出现表中数据中文乱码
- 使用PL/SQL导入数据(cvs和excel)
- (运维日志)对Excel进行数据导入,函数拼写Sql脚本,动态生成一列单元格函数
- 使用NPOI:Excel表向sql_server08数据库导入数据
- 使用PL/SQL将EXCEL数据导入到ORACLE数据库中
- Sql 脚本导入EXCEL数据
- pro*C 使用动态sql方法四实现数据批量导入导出
- 如何中把excel表中的数据用sql语句导入到数据表中
- 使用python将mysql数据导入excel-select into outfile
- SQL导入Excel数据
- Java 使用jxl.jar 导入导出Excel数据