I would like to make an sql query to compare two tables with identical columns, both names and types. Each table has a unique key. I want the query to return any rows that contain unequal values. I know could 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 this would be tedious since there are a large and potentially variable number of columns.
edit
If it helps, I'm using a tsql system.