I would like to make an SQL query to compare two tables with the same columns, names and types. Each table has a unique key. I want the query to return any rows containing unequal values. I know can do something like this
select * from table_1, table_2 where table_1.key = table_2.key and ( table_1.col1 != table_2.col1 OR table_1.col2 != table_2.col2 OR ... )
but that would be tedious since there are a large and potentially variable number of columns.
change
If this helps, I use the tsql system.
source share