110,567
社区成员
发帖
与我相关
我的任务
分享
--将数据导入临时表.database即excel路径,sheet1为excel工作薄名称
select * into # from OPENROWSET('microsoft.jet.oledb.4.0','Excel 5.0;hdr=yes;database=d:\1月安排.xls',sheet1$)
--将临时表与目标表不存在的数据插入目标表
insert into 目标表 select * from # a where not exists
(select 1 from 目标表 where name=a.name)--这里也可以写其他字段。。