UPDATE akuz.t_state_address
SET Street = s.StreetID
FROM akuz.t_street s
WHERE KladrCode = s.Code;

UPDATE akuz.t_state_address
SET District = s.District
FROM akuz.t_street s
WHERE Street = s.StreetID;

UPDATE akuz.t_state_address
SET City = s.City
FROM akuz.t_street s
WHERE Street = s.StreetID;

UPDATE akuz.t_state_address
SET District = d.DistrictID
FROM akuz.t_district d
WHERE KladrCode = d.Code;

UPDATE sa
SET City = d.City
FROM akuz.t_state_address sa
join akuz.t_district d on sa.District = d.DistrictID 
WHERE sa.City IS NULL;

UPDATE akuz.t_state_address
SET City = c.CityID
FROM akuz.t_city c
WHERE KladrCode = c.Code;