ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] ADD [Mkb] varchar(10) NULL
GO

update e
set e.Mkb = ehr.MKB_CODE
from RDS.T_EXPORT_FRLLO_NEEDS_ELEMENT e
join EHR.T_EHR_RUS_MKB308 ehr on ehr.EhrRusID = e.EhrRusMkb308

ALTER TABLE [RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT] DROP CONSTRAINT [FK_T_EHR_RUS_MKB308_T_EXPORT_FRLLO_NEEDS_ELEMENT_EhrRusMkb308]
GO

exec dbo.sp_AlterDropColumn '[RDS].[T_EXPORT_FRLLO_NEEDS_ELEMENT]' , 'EhrRusMkb308', 0
GO
