CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • [SOLVED]How to Export/Import Contact through SQL
Pages: [1]

Author Topic: [SOLVED]How to Export/Import Contact through SQL  (Read 2103 times)

williamgurumayum

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1.5.
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.0.95
  • PHP version: 5.3
[SOLVED]How to Export/Import Contact through SQL
September 03, 2012, 01:13:28 am
Hello,
I tried Exporting all my contacts by exporting the table civicrm_contact and dumping it into the new table, but i always get a Foreign Key constraint key error..
Is there any way to export/import contacts via SQL, through PHPMyADmin?
I have lots of Contacts.

Thanks
« Last Edit: September 04, 2012, 09:16:04 pm by williamgurumayum »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: How to Export/Import Contact through SQL
September 03, 2012, 04:37:46 am
I don't understand what you are doing. It sounds like you have two installs and you are trying to copy data between them. Please explain in more detail.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

williamgurumayum

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1.5.
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.0.95
  • PHP version: 5.3
Re: How to Export/Import Contact through SQL
September 03, 2012, 06:46:36 am
Hello Hershel,
Sorry, if my description was not good enough.
You are right, i have two CIVI installation on different servers. I want to move contact from one CIVI installation to the another. I tried exporting civicrm_contact from PHPMyAdmin and then imported this table on the New installation CIVI database. What i got is a bunch of FK errors...

Can you please guide me to do in the right way?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: How to Export/Import Contact through SQL
September 03, 2012, 07:15:16 am
The correct way to do this is to use the regular browser-based interface of CiviCRM and export your contacts into a CSV file from the old site and then import them into the new site. You can read more about this here:

http://wiki.civicrm.org/confluence/display/CRMDOC42/Importing+Data

http://en.flossmanuals.net/civicrm/ch019_importing/
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

williamgurumayum

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1.5.
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.0.95
  • PHP version: 5.3
Re: How to Export/Import Contact through SQL
September 04, 2012, 01:30:17 am
Hello Hershel,
Thanks for the reply. Yes i am aware of the CSV export/import. But what worries me is that CSV export/import doesn't work good for large datas, i have more than 10K contacts. What do you suggest? any precautions that i need to take so that my export is successful without any errors.

Thanks..

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: How to Export/Import Contact through SQL
September 04, 2012, 06:43:14 am
The amount of records you can import/export depends on your hardware actually. I have imported more than 10K records in one file.

Anyhow, if your situation doesn't allow that, then you should use the CiviCRM API to export and then import your data. You can run your code in batches to avoid issues of large datasets.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

williamgurumayum

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1.5.
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.0.95
  • PHP version: 5.3
Re: How to Export/Import Contact through SQL
September 04, 2012, 11:36:56 am
Hello Hershel,
Please forgive my ignorance.. Can you please tell me more about this CIVICRM API?

Thanks

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: How to Export/Import Contact through SQL
September 04, 2012, 11:42:44 am
http://wiki.civicrm.org/confluence/display/CRMDOC41/CiviCRM+Public+APIs
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

williamgurumayum

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 4.1.5.
  • CMS version: Joomla 2.5.6
  • MySQL version: 5.0.95
  • PHP version: 5.3
Re: How to Export/Import Contact through SQL
September 04, 2012, 09:15:21 pm
Wow!!.. Thanks a ton Hershel.. I will mark this post as Solved!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: [SOLVED]How to Export/Import Contact through SQL
September 04, 2012, 10:51:46 pm
My pleasure. :)
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • [SOLVED]How to Export/Import Contact through SQL

This forum was archived on 2017-11-26.