insert 表
select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Excel 8.0;IMEX=1;HDR=YES;DATABASE=c:\test.xls' --c:\test.xls是excel文件名
,sheet1$) --sheet1$是工作表名+$
alter Trigger CheckandExist on temp_employee_info
for insert,delete,update
as
if not exists (select * from deleted)
if not exists (select * from employee_info where employee_info.CDSID=(select CDSID from inserted))
insert employee_info(CDSID,Name,Email) select CDSID,Name,Email from inserted
else
update employee_info
set
employee_info.Name=(select Name from inserted),
employee_info.Email=(select Email from inserted)
where
employee_info.CDSID=(select CDSID from inserted)