I was looking for a way to check if two tables in the same database are identical (both contents and schema), and came over this question.
The top answer for the question uses (from my understanding) a MySQL specific. When trying to run the code in an Azure SQL Database I get this error: Incorrect syntax near the keyword 'TABLE'.
.
Instead of using CHECKSUM TABLE
to see if the two tables are identical we ended up using the two following queries:
select * from util.table1
except
select * from dbo.table2
select * from dbo.table2
except
select * from util.table1
So I essentially have three questions regarding this:
- Does Azure SQL Database have an equivalent to this query?
- Should we even use that query for checking if two tables are identical?
- Is the option we went for (using except) a viable option? if not, why not, and what can we do better?