How to locate Check Constraint Definitions

While working in CRM, there may be situations when a Check_Constraint error is received.
You can quickly locate the definition for a Check Constraint with the following script:
 
select definition 
from sys.check_constraints
where name = 'CK_Name_Here'
 
Here is an example for better understanding.
 
Error received when attempting to conduct an Import Process in CRM:
 
Check Constraint Error Example
 
Updated SQL Script to run against database:
 
select definition 
from sys.check_constraints
where name = 'CK_CREDITCARD_CREDITCARDFIELDSREQUIRED'
 
Results of Script:
 
([CREDITCARDTOKEN] IS NULL OR NOT [CREDITCARDTOKEN] IS NULL AND len([CARDHOLDERNAME])>(0) AND [EXPIRESON]<>'00000000' AND len([CREDITCARDPARTIALNUMBER])>(0))
 
What the Constraint means:
 
What this is telling us is that the import will only be able to process successfully in one of two scenarios, in reference to the Credit Card Token.
 
One of the situations below must evaluation True in order to pass the Check Constraint criteria:
 
1. When there is no Credit Card Token at all
2. If there is a Credit Card Token, then the record needs to have a Card Holder Name, Expires On date, and Partial Credit Card Number.
 
Likely scenario that is preventing the Import from working is that there is a Credit Card Token in the Import file, but no Card Holder Name, Expires On date, and Partial Credit Card Number.

Environment

 Blackbaud CRM
 4.0

Was this article helpful?