CREATE TABLE temp_dnitem_mkb
(
    DnitemID UNIQUEIDENTIFIER,
    DS_DISP  VARCHAR(20) NOT NULL
)
GO


INSERT INTO temp_dnitem_mkb (DnitemId, DS_DISP)
SELECT pb.DnitemId,
       mkb.MCBCode
FROM RDS.T_DN_item pb
JOIN RDS.T_MKB mkb ON mkb.MkbID = pb.DS_DISP
GO


ALTER TABLE RDS.T_DN_item
    DROP CONSTRAINT FK_T_MKB_T_DN_ITEM_DS_DISP
GO


ALTER TABLE RDS.T_DN_item
    DROP COLUMN DS_DISP
GO


ALTER TABLE RDS.T_DN_item ADD DS_DISP varchar(20)
GO


UPDATE pb
SET DS_DISP = tmp.DS_DISP
FROM RDS.T_DN_item pb
JOIN temp_dnitem_mkb tmp ON tmp.DnitemId = pb.DnitemId
GO


DROP TABLE temp_dnitem_mkb
GO