
INSERT INTO EHR.T_EHR_RUS_PRK237(EhrRusID)
SELECT EhrRusID 
FROM EHR.T_EHR_RUS er
WHERE EXISTS (SELECT * FROM VCLib.T_ENTITIES e WHERE e.EntName = 'EHR_RUS_PRK237' AND e.EntityID = er.type_)
AND NOT EXISTS(SELECT * FROM EHR.T_EHR_RUS_PRK237 ehrRus WHERE ehrRus.EhrRusID = er.EhrRusID)