欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Excel导入Sqlserver数据库脚本

程序员文章站 2023-11-29 09:42:10
受以前旧同事之托,在博客里发这段脚本: exec sp_configure 'show advanced options',1 reconfigure exec sp_co...
受以前旧同事之托,在博客里发这段脚本:

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