一、导入到 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',1reconfigure
然后执行:
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 ', 0
reconfigure