• There was a post that hit the nail on the head. Your where clause that stipulates that RAT_FILENAME IS NOT NULL does not limit results due to there being no NULL RAT_FILENAME columns... You want to look for NULLs after the join is complete.

    More to the point would be something like;

    /* return all IIAFeedTransaction.IIATransactionId values that are

    * not used in the RATSIIAFeedTransaction.RAT_FILENAME values

    */

    SELECT

    IIATransactionId

    FROM

    dbo.IIAFeedTransaction

    WHERE

    IIATransactionId IN (

    SELECT SubString(RATS_FILENAME,1+PatIndex('%{________-____-____-____-____________}%',RATS_FILENAME),36)

    FROM dbo.RATSIIAFeedTransaction

    )