Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Compare two Table data and insert changed field to the third table RE: Compare two Table data and insert changed field to the third table<!-- 864 -->

  • Phil Parkin (8/21/2014)


    Maybe this would be a slightly better WHERE clause (handles NULLs)?

    WHERE NOT EXISTS ( SELECT B1.[BedDays]

    ,B1.[UserCode]

    ,B1.[ISVirtual]

    ,B1.[FirstName]

    ,B1.[LastName]

    ,B1.[BeneficiaryName]

    ,B1.[ReferralDate]

    INTERSECT

    SELECT B2.[BedDays]

    ,B2.[UserCode]

    ,B2.[ISVirtual]

    ,B2.[FirstName]

    ,B2.[LastName]

    ,B2.[BeneficiaryName]

    ,B2.[ReferralDate] )

    Good point, thanks Phil!

    😎