I've got a target DE with the following data privileges:

  • ContactId = PRIMARY KEY
  • Email = Nullable
  • FirstName = Nullable
  • HomeStore = Nullable
  • State = Nullable

I am currently running this query and am resulting in the error message "Cannot insert a NULL value into a non-nullable column. What is interesting is we have several versions of this query for different lists we use and the only thing that is different is the Department__c and Class__c categories.

Any ideas would be greatly appreciated!


enter image description here

1 Answer 1


It looks like your 'OR' statement for Department__c needs to be grouped together, as it's evaluating the OR statements in line with the AND statments. For example:

ContactID__c IS NOT NULL OR (Department__c = '2' AND Class_c = 'A')

In the statement above null values are considered valid for ContactID__c if the second part of the expression is true.

Try an extra pair of parentheses before the first and after the last department/class comparisons.

  • Brilliant! Thank you, I put quotes around the first like of Department & Class and that didn't work but when I added the second level of parentheses around the at large OR process it functioned perfectly. Thank you so much!
    – Cameron
    Jan 20, 2020 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.