update AKUZ.T_CARD_NOTE
set EmdrBaseObjectEnt = (select top 1 EntityId from vclib.T_ENTITIES where EntName = SUBSTRING(EmdrBaseObjectName, 6, LEN(EmdrBaseObjectName) - 5))
Where EmdrBaseObjectName is not null and EmdrBaseObjectEnt is null
GO