left join Redbook.RedBook.dbo.sdmdm1 rdm on rdm.matnr='0000000000'+sm.material_matnr select sm.material_id, sm.material_matnr, sm.material_maktx, sm.material_vkorg, sm.material_vtweg, sm.material_meins, sm.material_spart, sm.material_vtext, sm.material_matkl, sm.material_wgbez, sm.material_dwjz, case when rdm.当前厂价=0 then null else rdm.当前厂价 end material_changj, sm.material_xingh, sm.material_guig, sm.material_jiem, sm.material_diany, sm.material_temp, sm.material_model, material_mrbs, material_sfyx from sap_material sm insert into sap_material material_matnr, material_maktx, material_vkorg, material_vtweg, material_meins, material_spart, material_vtext, material_matkl, material_wgbez, material_dwjz, material_changj, material_xingh, material_guig, material_jiem, material_diany, material_temp, material_model, material_mrbs, material_sfyx, #{materialMatnr}, #{materialMaktx}, #{materialVkorg}, #{materialVtweg}, #{materialMeins}, #{materialSpart}, #{materialVtext}, #{materialMatkl}, #{materialWgbez}, #{materialDwjz}, #{materialChangj}, #{materialXingh}, #{materialGuig}, #{materialJiem}, #{materialDiany}, #{materialTemp}, #{materialModel}, #{materialMrbs}, #{materialSfyx}, update sap_material material_matnr = #{materialMatnr}, material_maktx = #{materialMaktx}, material_vkorg = #{materialVkorg}, material_vtweg = #{materialVtweg}, material_meins = #{materialMeins}, material_spart = #{materialSpart}, material_vtext = #{materialVtext}, material_matkl = #{materialMatkl}, material_wgbez = #{materialWgbez}, material_dwjz = #{materialDwjz}, material_changj = #{materialChangj}, material_xingh = #{materialXingh}, material_guig = #{materialGuig}, material_jiem = #{materialJiem}, material_diany = #{materialDiany}, material_temp = #{materialTemp}, material_model = #{materialModel}, material_mrbs = #{materialMrbs}, material_sfyx = #{materialSfyx}, where material_id = #{materialId} delete from sap_material where material_id = #{materialId} delete from sap_material where material_id in #{materialId}