-- Tables

-- Alters

ALTER TABLE AKUZ.T_VISION_ACUITY ADD LightFlashesCriticalFrequency_R int NULL
GO

ALTER TABLE AKUZ.T_VISION_ACUITY ADD LightFlashesCriticalFrequency_L int NULL
GO

update va
set va.LightFlashesCriticalFrequency_R = vd.LightFlashesCriticalFrequency_R, va.LightFlashesCriticalFrequency_L = vd.LightFlashesCriticalFrequency_L
from AKUZ.T_VISION_ACUITY va
join AKUZ.T_VISION_DIAGNOSTICS vd on vd.MedicalRecordId = va.VisionDiagnostics

ALTER TABLE AKUZ.T_VISION_DIAGNOSTICS ADD RetinalVisualAcuity_R decimal(7, 3) NULL
GO

ALTER TABLE AKUZ.T_VISION_DIAGNOSTICS ADD RetinalVisualAcuity_L decimal(7, 3) NULL
GO

update vd
set vd.RetinalVisualAcuity_R = va.RetinalVisualAcuity_R, vd.RetinalVisualAcuity_L = va.RetinalVisualAcuity_L
from AKUZ.T_VISION_DIAGNOSTICS vd
join AKUZ.T_VISION_ACUITY va on vd.MedicalRecordId = va.VisionDiagnostics


ALTER TABLE AKUZ.T_VISION_ACUITY DROP COLUMN RetinalVisualAcuity_R
ALTER TABLE AKUZ.T_VISION_ACUITY DROP COLUMN RetinalVisualAcuity_L
ALTER TABLE AKUZ.T_VISION_DIAGNOSTICS DROP COLUMN LightFlashesCriticalFrequency_R
ALTER TABLE AKUZ.T_VISION_DIAGNOSTICS DROP COLUMN LightFlashesCriticalFrequency_L
