Answers.Body: <p>I don't think there's an extension but there is an api (<a href="https://docs.civicrm.org/dev/en/latest/api/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/api/</a>). If you do it in SQL it wouldn't autoupdate other items like the &quot;display_name&quot;, so you could write a little php script using the api to do it, and then run it with <code>cv php:script</code>. Basically you would want Contact.get and then Contact.create, e.g. something like (untested! Make a backup!)</p>
  <pre><code>$contacts = civicrm_api3('contact', 'get', ['contact_type' =&gt; 'Individual']);
  foreach ($contacts['values'] as $c) {
    civicrm_api3('contact', 'create', [
      'id' =&gt; $c['id'],
      'first_name' =&gt; $c['nick_name'],
    ]);
  }
  </code></pre>
  <p>You may also want to e.g. check that nick_name isn't blank for that record. May need to experiment.</p>
  <p>FYI contact.create means &quot;update&quot; when you give it an <code>id</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-11T20:02:53.773Z
Answers.Text: Great, thanks, I am going to work on it!
Answers.UserDisplayName: Dirkjan from AJO Amersfoort
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-13T02:42:59.027Z
Answers.Text: another option might be an export/import but would need to check how to deal with a field, eg nickname, which might have data but which should be overwritten to be NULL or empty
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-11T18:55:23.560Z
Answers.LastActivityDate: 2022-01-11T18:55:23.560Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>You could do it just with API Explorer 4 using chaining:</p>
  <p><a href="https://i.sstatic.net/ST7e7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ST7e7.png" alt="enter image description here" /></a></p>
  <p>I've added a couple of 'where' clauses for minor sanity - you might want to adjust those.</p>
  <p>This finds all the contacts satisfying the 'where' clauses and for each one, runs an update where <code>$id</code> and <code>$nick_name</code> in the chain clause refer to the values from the contact just looked up.</p>
  <p>Take a backup &amp; test carefully!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-14T22:17:36.883Z
Answers.Text: Thanks for the great write up on how to do this
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-14T19:01:30.063Z
Answers.LastActivityDate: 2022-01-14T19:01:30.063Z
Answers.UserDisplayName: Aidan
Body: <p>I recently have taken over managing CiviCRM for an orchestra in Holland. Some fields have been used inconsistently, for example Nickname and First Name. I now need to copy all data in Nickname to First Name. That would be no problem running a SQL query, but I am afraid that would be too bold a step in CiviCRM. How do I go about? Is there an extension to do the job?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-12T04:16:09.763Z
Comments.Text: Why not just import the nickname field to first name field?
Comments.UserDisplayName: Andy Burns
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-01-13T02:43:57.223Z
Comments.Text: this is something we would likely do via an sql query - but you would also need to then update Display Name and Sort Name fields, so they showed the updated data, via another query
Comments.UserDisplayName: petednz - fuzion
Tags: <extension><database><mysql><fields>
Title: Move data from field to another field as a batch
ThreadText: # Move data from field to another field as a batch
  
  (Asked by: username_0 on 2022-01-11)
  
  I recently have taken over managing CiviCRM for an orchestra in Holland. Some fields have been used inconsistently, for example Nickname and First Name. I now need to copy all data in Nickname to First Name. That would be no problem running a SQL query, but I am afraid that would be too bold a step in CiviCRM. How do I go about? Is there an extension to do the job?
  
  **Tags:** extension, database, mysql, fields
  
  > **Comments:**
  > **username_1**: Why not just import the nickname field to first name field?  
  > **username_2**: this is something we would likely do via an sql query - but you would also need to then update Display Name and Sort Name fields, so they showed the updated data, via another query  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2022-01-11. Score: 1 | Accepted answer
  
  I don't think there's an extension but there is an api (<https://docs.civicrm.org/dev/en/latest/api/>). If you do it in SQL it wouldn't autoupdate other items like the "display\_name", so you could write a little php script using the api to do it, and then run it with `cv php:script`. Basically you would want Contact.get and then Contact.create, e.g. something like (untested! Make a backup!)
  
  ```
  $contacts = civicrm_api3('contact', 'get', ['contact_type' => 'Individual']);
  foreach ($contacts['values'] as $c) {
    civicrm_api3('contact', 'create', [
      'id' => $c['id'],
      'first_name' => $c['nick_name'],
    ]);
  }
  
  ```
  
  You may also want to e.g. check that nick\_name isn't blank for that record. May need to experiment.
  
  FYI contact.create means "update" when you give it an `id`.
  
  > **Comments:**
  > **username_0**: Great, thanks, I am going to work on it!  
  > **username_2**: another option might be an export/import but would need to check how to deal with a field, eg nickname, which might have data but which should be overwritten to be NULL or empty  
  
  ---
  
  ### Answer by username_4 on 2022-01-14. Score: 2
  
  You could do it just with API Explorer 4 using chaining:
  
  [![enter image description here](https://i.sstatic.net/ST7e7.png)](https://i.sstatic.net/ST7e7.png)
  
  I've added a couple of 'where' clauses for minor sanity - you might want to adjust those.
  
  This finds all the contacts satisfying the 'where' clauses and for each one, runs an update where `$id` and `$nick_name` in the chain clause refer to the values from the contact just looked up.
  
  Take a backup & test carefully!
  
  > **Comments:**
  > **username_2**: Thanks for the great write up on how to do this  
  
  ---
  
  