• Hmmm... Interesting.

    A couple of problems though. I wanted to get a list of values that exist in one table and not the other. I also tried running it with the value set to 'IS NULL' and got no results. I then took the 'IS NOT NULL' completely out of the query and it still returned the results below. Also, when you look at the query plan generated between the left outer join & your query, yours results in a hash table for the join which is going to seriously impact performance on large scale queries (which, admittedly, the sample data in the article is teeny-tiny, but the real data is several hundred thousand rows, again, not big, but big enough to notice a hash join).

    When I ran your query, I got this:

    IIATransactionId                                       OracleTransactionId

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

    365A0FD8-5042-4297-A082-8F5B11450AF4 365A0FD8-5042-4297-A082-8F5B11450AF4

    16706611-C94D-4FBC-8F4E-9077C3B9E697 16706611-C94D-4FBC-8F4E-9077C3B9E697

    55DD6703-9693-45E2-A339-987066EA2864 55DD6703-9693-45E2-A339-987066EA2864

    F4849137-6454-46E5-9811-A6985A189249 F4849137-6454-46E5-9811-A6985A189249

    instead of this:

    IIATransactionId                                      OracleTransactionId

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

    9B33A776-408B-4928-AE2A-0FF43995DE12 NULL

    8EEA51CE-D87A-4F76-B9C1-7AD11532D444 NULL

    5D31FD56-7C0B-408B-83A5-864B7BD35ADC NULL

    A721BD38-9C76-4C3A-A7C5-9CC0227F90F4 NULL

     

     

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning