当前位置: 移动技术网 > IT编程>数据库>MSSQL > Excel导入Sqlserver数据库脚本

Excel导入Sqlserver数据库脚本

2017年12月12日  | 移动技术网IT编程  | 我要评论

刑峰,翟洪生,高树玛利亚种子

受以前旧同事之托,在博客里发这段脚本:

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'ad hoc distributed queries',1
reconfigure

select * into tmp_asset
from openrowset('microsoft.jet.oledb.4.0',
'excel 8.0;database=d:\excel数据源\资产印章.xls',
'select * from [sheet1$]') ;

说明:

d:\excel数据源\资产印章.xls ---------> 为文件存放的物理路径.

from [sheet1$] ----------> 其中的sheet1为工作表的名称.

剩下的就是对tmp_asset相关的列进行一些数据匹配了,这里就不多说了:)

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网