update r
set r.FrlloId = fed.frllorecipe_id
from RDS.T_RECIPE r
join RDS.T_EXPORT_FRLLO_RECIPE_DATA fed on fed.ObjId = r.RecipeID
where fed.frllorecipe_id is not null
GO

update re
set re.FrlloId = fed.frllorecipe_id
from RDS.T_RECIPE_ELEMENT re
join RDS.T_EXPORT_FRLLO_RECIPE_DATA fed on fed.ObjId = re.RecipeElementID
where fed.frllorecipe_id is not null
GO

ALTER TABLE [RDS].[T_EXPORT_FRLLO_RECIPE_DATA] ADD [RegNum] varchar(100) NULL
GO

update [RDS].[T_EXPORT_FRLLO_RECIPE_DATA] set [RegNum] = FrlloId, [FrlloId] = FrlloRecipe_id;
GO

exec dbo.sp_AlterDropColumn '[RDS].[T_EXPORT_FRLLO_RECIPE_DATA]' , 'FrlloRecipe_id', 0
GO


