Answers.Body: <p>I have found that in order for CiviCRM to accept the country field during an import you have to spell the country exactly as it is written in CiviCRM DB. For example you cannot import 'UK', but 'Great Britain' instead (not sure if I remember the values correctly, but this is the concept anyway).</p>
  
  <p>If this is your case indeed, you will have to export the country list from CiviCRM and use it to populate the respective field in your csv file.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-29T05:19:43.617Z
Answers.Text: Right. The client actually had used USA instead of UNITED STATES (and it has to be capitalized) but even after changing that (it was actually the only country that was used in this file) the import still wouldn't work. Only way it did was to make a new Country field and instead of using the default country dropdown Civi provides, I created one on my own, using the exact same field names. Worked. Import successful. Very odd.
Answers.UserDisplayName: Adam Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-28T19:28:02.130Z
Answers.LastActivityDate: 2016-02-28T19:28:02.130Z
Answers.UserDisplayName: Vassilis Chryssos
Answers.Body: <p>Two things:
  * "DB Error: constraint violation" isn't enough information to troubleshoot.  If you get an error like this, turn on debugging and backtrace:  <strong>Administration menu > System Settings > Debugging and Error Handling</strong>.  Posting the debug info and a backtrace greatly increases others' ability to help!
  * What you're describing is a known bug:  <a href="https://issues.civicrm.org/jira/browse/CRM-17893" rel="nofollow">See here</a>.  Unfortunately, no one who's affected this has stepped up yet with a fix, or funds for the core team to fix it.</p>
  
  <p>To give the usual pitch:  CiviCRM is free to use, but not free to write.  If you're making part of your living from CiviCRM, please consider being part of the community of folks who either fixes bugs or pays people to fix bugs.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-27T21:47:28.967Z
Answers.LastActivityDate: 2016-02-27T21:47:28.967Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>Having an issue where I'm trying to import a series of CSV files into the Civi Contact Database. There were new custom fields created to do the import, but when I do the import with all the fields, I get an 'DB Error: constraint violation' error. If I just import the fields that were originally there, I successfully import the CSV into the DB.</p>
  
  <p>So I must have done something wrong with the custom fields I created yesterday. But what? What should I look for to make sure the import is successful?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-27T20:03:07.353Z
Comments.Text: Update: I found that the issue was the custom field for Institution Country. If I tell that not to import, the problem is gone. However, the client wants it, so I have to figure out why this is occurring. Is this because I have another country field set in the main / default contact set?
Comments.UserDisplayName: Adam Bell
Tags: <custom-fields><import>
Title: Custom Fields not importing into contacts database
ThreadText: # Custom Fields not importing into contacts database
  
  (Asked by: username_0 on 2016-02-27)
  
  Having an issue where I'm trying to import a series of CSV files into the Civi Contact Database. There were new custom fields created to do the import, but when I do the import with all the fields, I get an 'DB Error: constraint violation' error. If I just import the fields that were originally there, I successfully import the CSV into the DB.
  
  So I must have done something wrong with the custom fields I created yesterday. But what? What should I look for to make sure the import is successful?
  
  **Tags:** custom-fields, import
  
  > **Comments:**
  > **username_0**: Update: I found that the issue was the custom field for Institution Country. If I tell that not to import, the problem is gone. However, the client wants it, so I have to figure out why this is occurring. Is this because I have another country field set in the main / default contact set?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-02-28. Score: 0 | Accepted answer
  
  I have found that in order for CiviCRM to accept the country field during an import you have to spell the country exactly as it is written in CiviCRM DB. For example you cannot import 'UK', but 'Great Britain' instead (not sure if I remember the values correctly, but this is the concept anyway).
  
  If this is your case indeed, you will have to export the country list from CiviCRM and use it to populate the respective field in your csv file.
  
  > **Comments:**
  > **username_0**: Right. The client actually had used USA instead of UNITED STATES (and it has to be capitalized) but even after changing that (it was actually the only country that was used in this file) the import still wouldn't work. Only way it did was to make a new Country field and instead of using the default country dropdown Civi provides, I created one on my own, using the exact same field names. Worked. Import successful. Very odd.  
  
  ---
  
  ### Answer by username_2 on 2016-02-27. Score: 0
  
  Two things:
  \* "DB Error: constraint violation" isn't enough information to troubleshoot. If you get an error like this, turn on debugging and backtrace: **Administration menu > System Settings > Debugging and Error Handling**. Posting the debug info and a backtrace greatly increases others' ability to help!
  \* What you're describing is a known bug: [See here](https://issues.civicrm.org/jira/browse/CRM-17893). Unfortunately, no one who's affected this has stepped up yet with a fix, or funds for the core team to fix it.
  
  To give the usual pitch: CiviCRM is free to use, but not free to write. If you're making part of your living from CiviCRM, please consider being part of the community of folks who either fixes bugs or pays people to fix bugs.
  
  
  ---
  
  