This is my simplified statement
SELECT ...
FROM tab1 AS i FULL OUTER JOIN tab2 AS d ON i.[Id]=d.[Id]
WHERE d.[Data]<>i.[Data] OR
(d.[Data] IS NULL AND i.[Data] IS NOT NULL) OR
(d.[Data] IS NOT NULL AND i.[Data] IS NULL)
I want to get all entries that are
- i.[Data] is different from d.[Data]
- At least one value in table i or d is NOT NULL
So I don't want to see records were and i and d contain the same data or are both NULL.
My statement look so long and complicated. Is there an easier way?
Using ISNULL(d.[Data],'')<>ISNULL(i.[Data],'') works for text, but not for DATE or TIME(0) columns.
My statement works for every type.