# Copy values from one custom attribute to another

**URL:** <https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882>\
**Category:** Product Support\
**Created:** [June 17, 2021, 6:36am UTC](https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882 "2021-06-17T06:36:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![imog](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/imog/32/3813_2.png) [@imog](https://forum.mautic.org/u/imog)\
**Post date:** [June 17, 2021, 6:36am UTC](https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882/1 "2021-06-17T06:36:19Z")

</div>

I’ve created a custom attribute and filled it with data for many contacts. Now i found that the ID of the custom attribute was choosen bad but it can’t be changed (in the GUI) afterwards and so i thought to simply create a new one, copy the data over and remove the old one.  
But i don’t know how to do this in the Mautic GUI? Maybe there is a way to do it in the SQL-DB?

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [June 17, 2021, 7:01am UTC](https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882/2 "2021-06-17T07:01:19Z")

</div>

Custom fields are stored as table columns (unless you use a special plugin).  
So you would need to read it out and write it in the new place.  
Joey

---

<div class="post-metadata">

**Author:** ![imog](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/imog/32/3813_2.png) [@imog](https://forum.mautic.org/u/imog)\
**Post date:** [June 17, 2021, 1:39pm UTC](https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882/3 "2021-06-17T13:39:17Z")

</div>

Oh well, that easy?! Ok, i found the custom fields are stored as direct accessible columns in the table “leads”. So it simply took:  
`UPDATE leads SET newfield = oldfield;`  
and that’s it. Means that adding a custom field involves a schema change in this table.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [June 19, 2021, 6:25am UTC](https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882/4 "2021-06-19T06:25:02Z")

</div>

Did it work 🙂

---

<div class="post-metadata">

**Author:** ![imog](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/imog/32/3813_2.png) [@imog](https://forum.mautic.org/u/imog)\
**Post date:** [June 19, 2021, 1:56pm UTC](https://forum.mautic.org/t/copy-values-from-one-custom-attribute-to-another/19882/5 "2021-06-19T13:56:48Z")

</div>

Oh yes, it did 🙂  
I wonder if i could have changed the name of the field instead, in the same easy manner?  
Like

```auto
ALTER TABLE leads RENAME oldfied TO newfield;

```
