If you insist on a column level report you need to split all columns into rows before comparison like:
select *
from
(
select name, 'city' as column_name, city as source_value from source_table
union all
select name, 'pincode', pincode from source_table
) as s
full outer join
(
select name, 'city' as column_name, city as target_value from target_table
union all
select name, 'pincode', pincode from target_table
) as t
on s.name = t.name and s.column_name = t.columnname
where not ((s.source_value = t.target_value) or
(s.source_value is null and t.target_value is null))
Dieter
↧