Учитывая, что [anything] + NULL + [anything]
равно нулю, как насчет;
declare @t table(A1 int, A2 int, A3 int, A4 int, A5 int, A6 int)
insert @t values
(NULL, 2 , 3, 4, 5, 6),
(1, NULL, 3, 4, 5, 6),
(1, 2, NULL, 4, 5, 6),
(1, 2, 3, NULL, 5, 6),
(1, 2, 3, 4, NULL, 6),
(1, 2, 3, 4, 5, NULL),
(1, 2, 3, 4, 5, 6)
update @t
set A1 = coalesce(A1, A2),
A2 = case when A1 + A2 is null then A3 else A2 end,
A3 = case when A1 + A2 + A3 is null then A4 else A3 end,
A4 = case when A1 + A2 + A3 + A4 is null then A5 else A4 end,
A5 = case when A1 + A2 + A3 + A4 + A5 is null then A6 else A5 end,
A6 = case when A1 + A2 + A3 + A4 + A5 is null then null else A6 end
from @t
select * from @t
A1 A2 A3 A4 A5 A6
2 3 4 5 6 NULL
1 3 4 5 6 NULL
1 2 4 5 6 NULL
1 2 3 5 6 NULL
1 2 3 4 6 NULL
1 2 3 4 5 NULL
1 2 3 4 5 6