Best way to compare contents of two tables in Teradata?

Cade Roux picture Cade Roux · Mar 18, 2010 · Viewed 16.7k times · Source

When you need to compare two tables to see what the differences are, are there any tools or shortcuts you use, or do you handcode the SQL to compare the two tables?

Basically the core features of a product like Red Gate SQL Data Compare (schemas for my tables typically always match).

Background: In my SQL Server environment, I created a stored procedure which inspects the metadata of the two tables/views, creates a query (as dynamic sql) which joins the two tables on the specified key columns, and compares data in the compare columns, reporting key differences and data differences. The query can either be printed and modified/copied or just excecuted as is. We are not allowed to create stored procedures in our Teradata environment, unfortunately.

Answer

Rob Paller picture Rob Paller · Mar 18, 2010

Sounds like a data profiling tool such as Talend's Open Profiler would make the most sense at that point.

You could write a BTEQ statement that builds the query similar to your SQL Server stored procedure and then export the dynamically built SQL. You can then in turn run that inside of your BTEQ. It might get cumbersome, but with enough determination you could probably mock something up.