update a set a.Branch = h.Branch from Article_Dim a right join Branch_Help h on h.Article = a.ArticleKey declare @i int set @i = 1 while @i <= 15 begin update a set a.Branch = b.Branch from Article_Dim a right join Article_Dim b on a.ParentKey = b.ArticleKey set @i = @i +1 end