-- Tables

-- Alters

update cb
    set cb.[ExaminationState] = 0
from [AKUZ].[T_ONK_CYTOLOGY_ROUTE_BASE] cb

update cb
    set cb.[ExaminationState] = 2
from [AKUZ].[T_ONK_CYTOLOGY_ROUTE_BASE] cb
    join [AKUZ].T_ONK_CYTOLOGY_RESULT_BASE cr on cr.OnkCytologyRoute = cb.AddParamsBaseID

ALTER TABLE [AKUZ].[T_ONK_ANATOMICAL_EXAMINATION_PROTOCOL] ALTER COLUMN [ExaminationState] int NOT NULL
GO