I am backloading data from a SQL Server table into a DB2 table. I am getting the same error for all of my null date columns:
Operand type clash: int is incompatible with date
It seems to be caused by weird "null date is being treated as 0, maybe" behavior no matter if I use Openquery or LinkedServer. I am using a temp table with a date column named ACTUAL_CLOSED.
I cannot share the source directly. But I can recreate with foobar if absolutely necessary
Test cases below:
Case 1: column IS null in temp table --> FAIL
Case 2: I hardcode the insert value with null at insert and comment the original "null, --ACTUAL_CLOSED" --> SUCCESS
Case 3: I use COALESCE to force a "hard coded" null "COALESCE(ACTUAL_CLOSED, null)" --> FAIL
Case 4: I use IS_NULL to force a "hard coded" null "IS_NULL (ACTUAL_CLOSED, null)" --> FAIL
Case 5: I use a case statement and check for null AND 0 "case when ACTUAL_CLOSED = 0 or ACTUAL_CLOSED is null then null else ACTUAL_CLOSED end as 'ACTUAL_CLOSED"' --> FAIL
Case 6: I update the temp table with NULL after loading it before insert to DB2 --> FAIL
Any help understanding is appreciated