update mc
set mc.OpenDate = dbo.fn_GetMedicalCertificateOpenDate(mc.MedicalRecordID)
from AKUZ.T_MEDICAL_CERTIFICATE mc
where mc.OpenDate is null

drop function [dbo].[fn_GetMedicalCertificateOpenDate]