• Jonathan Marshall (11/12/2013)


    The queries are updating lookup tables that do not have a value by using a subquery to the lookup table.

    I like that idea of using a computed column as these will be scanning through lots of data.

    WHERE [column1] + [column2] NOT IN

    (SELECT [column3] + [column4] from dbo.table order by [column1] + [column2])

    WHERE NOT EXISTS (SELECT 1 FROM dbo.table t WHERE t.[column3] = [column1] and t.[column4] = [column2])

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass