if not exists(SELECT 1 from pr_equipmentFacility eq
inner join pr_equipmentFacilityEx ex
on eq.equipmentFacilityID = ex.equipmentFacilityID where eq.equipmentFacilityCode='对应编码')
INSERT into pr_equipmentFacilityEx (equipmentFacilityID,brand,equipment_status,equipmentSRMCode,maintenanceCom,registCode,main_wirerope_change_time,lp_wirerope_change_time)
select equipmentFacilityID, manufacturer
,1,equipmentSRMCode,maintenanceCom,'注册码','2013/4/1','2013/4/1'from pr_equipmentFacility where equipmentFacilityCode ='对应编码'
else update ex set ex.main_wirerope_change_time = '2013/4/1',ex.lp_wirerope_change_time='2013/4/1',ex.registCode='30101101052013070158' from pr_equipmentFacilityEx ex inner join pr_equipmentFacility eq on eq.equipmentFacilityID = ex.equipmentFacilityID
where eq.equipmentFacilityCode ='-001692870=01050101+110105001201305000001000';
UPDATE pr_equipmentFacility set modifyTime=GETDATE() where equipmentFacilityCode ='对应编码';