if(not exists (select * from sys.all_columns c 
						join sys.tables t on t.object_id = c.object_id
						where c.name = 'HasTextContent' and t.name = 'T_RDS_SYNCHRONISATION_ERRORS'))
begin
ALTER TABLE AKUZ.T_RDS_SYNCHRONISATION_ERRORS ADD [HasTextContent]  AS (CONVERT([bit],case when [TextContent] IS NOT NULL then (1) else (0) end,0))
end
if(not exists (select * from sys.all_columns c 
						join sys.tables t on t.object_id = c.object_id
						where c.name = 'HasByteContent' and t.name = 'T_RDS_SYNCHRONISATION_ERRORS'))
begin
ALTER TABLE AKUZ.T_RDS_SYNCHRONISATION_ERRORS ADD [HasByteContent]  AS (CONVERT([bit],case when [ByteContent] IS NOT NULL then (1) else (0) end,(0)))
end
if(not exists (select * from sys.all_columns c 
						join sys.tables t on t.object_id = c.object_id
						where c.name = 'ExaminationFactors' and t.name = 'T_CALC_LINK_WORK_FACTOR'))
begin
ALTER TABLE AKUZ.T_CALC_LINK_WORK_FACTOR ADD [ExaminationFactors]  AS (CONVERT([varchar](36),[ExaminationRequest],0)+CONVERT([varchar](36),[BaseExaminationWorkFactor],0))
end
if(not exists (select * from sys.all_columns c 
						join sys.tables t on t.object_id = c.object_id
						where c.name = 'ExaminationServices' and t.name = 'T_CALC_LINK_MEDICAL_SERVICE'))
begin
ALTER TABLE AKUZ.T_CALC_LINK_MEDICAL_SERVICE ADD ExaminationServices  AS (CONVERT([varchar](36),[ExaminationRequest],0)+CONVERT([varchar](36),[MedicalService],0))
end
if(not exists (select * from sys.all_columns c 
						join sys.tables t on t.object_id = c.object_id
						where c.name = 'year' and t.name = 'T_RECIPE'))
begin
ALTER TABLE AKUZ.T_RECIPE ADD [year]  AS (datepart(year,[recipedate]))
end


