• It's not so bad to maintain. You just have to extend the WHERE clause:

    WHERE ABS(RandomNumberDiff) > @Tolerance

    to the following:

    WHERE (

    ABS(RandomNumberDiff) > @Tolerance

    OR ABS(RandomNumberDiff2) > @Tolerance

    OR ABS(RandomNumberDiff3) > @Tolerance

    ...

    )

    to get the desired result. If you had 50 columns to compare, then it would make sense to generate this code using a query off INFORMATION_SCHEMA.COLUMNS.

    This is definitely a real-world technique. We're using it at my company to compare 10's of thousands of rows across over 20 columns to reconcile datasets from disparate systems.

    In the next chapter of this article I'll explain why it's useful to have the exact differences like this, and not just the identification of rows that are different from source to destination.