DELETE FROM asurnet.dbo.EJEOFIC

INSERT INTO asurnet.dbo.EJEOFIC
SELECT C.IDTSS, B.IDTSS
FROM vsegbas.dbo.EJEOFIC A
INNER JOIN (
	SELECT * FROM tssseg0001.dbo.IDTraspasos
	WHERE TableID = 'Oficinas'
) B ON A.OFI_ID = B.IdTras
INNER JOIN tssseg0001.dbo.IDTraspasos C ON A.EJE_ID = C.IdTras AND C.TableID = 'Ejecutivos'