Help get this topic noticed by sharing it on Twitter, Facebook, or email.

EXCEPT query fails with SFDC lookup columns

We're using DBAmp to validate the accuracy of our local copy of SFDC using the SQL EXCEPT operator like so:

select col 1, col2. col3
from [local db].dbo.Table1
select col 1, col2. col3
from DBAmp LinkedServer....Table1

This is working fine with the exception of SFDC lookup columns which select fine but using EXCEPT return the following error:

OLE DB provider "DBAmp.DBAmp" for linked server "SFDCDEV" returned message "Error 1 : MALFORMED_QUERY:
where ((((((((( ( CD__c ='1' or ( '1' = null and CD__c = null )

ERROR at Row:1:Column:76
unexpected token: '1'".
Msg 7320, Level 16, State 2, Line 315
Cannot execute the query "SELECT 1 FROM "" "Tbl1006" WHERE (? = "Tbl1006"."col1" OR ? IS NULL AND "Tbl1006"."col2" IS NULL) AND etc. etc......

1 person has
this question