Excel导入Sqlserver数据库脚本

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

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相关的列进行一些数据匹配了,这里就不多说了:)

(0)
上一篇 2022年3月21日
下一篇 2022年3月21日

相关推荐