Home Forums SQL Server 2012 SQL 2012 - General Comparing column data in 2 tables with the same schema containing 1.5 billion records RE: Comparing column data in 2 tables with the same schema containing 1.5 billion records

  • JayK (4/15/2013)


    Hi Perry,

    Thanks for getting back - in reality I just need to check that data in a single column is the same for each matching PK in the 2 tables.

    So each table as an ID and an EffectiveEndDate column - each table will have the same number of rows - approx 1.5 billions rows. They should be a copy of each other but I need to ensure for each row has the same value for EffectiveEndDate in both tables,

    Thanks again for your reply,

    JK

    use a select query on the columns required from each of the tables and apply the except operator, any differences in the column data will be returned, like so

    select somecolumn, anothercolumn from thetablea

    except

    select somecolumn, anothercolumn from thetableb

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉