# Update Persistence without changing timestamps

**URL:** <https://community.openhab.org/t/update-persistence-without-changing-timestamps/125215>\
**Category:** Tutorials & Examples\
**Tags:** mysql, persistence, mariadb\
**Created:** [August 5, 2021, 7:42am UTC](https://community.openhab.org/t/update-persistence-without-changing-timestamps/125215 "2021-08-05T07:42:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![binderth](https://community.openhab.org/user_avatar/community.openhab.org/binderth/32/56257_2.png) [@binderth](https://community.openhab.org/u/binderth)\
**Post date:** [August 5, 2021, 7:42am UTC](https://community.openhab.org/t/update-persistence-without-changing-timestamps/125215/1 "2021-08-05T07:42:03Z")

</div>

If you change for some reason your Unit of Measurement of an item and like to update your persistence for that item (or if you just like to update specific items for whatever reason), you surely came across the problem of the auto-update in the items-tables (`CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)`).

The following SQL-syntax works with updating values (e.g. changing from `cm` to `mm`):

```auto
UPDATE itemXXX SET time = time, value = value * 10 

```

if enabled, you have to turn off safe mode - and turn it on afterwards! 😉 :

```auto
SET SQL_SAFE_UPDATES=0;
   UPDATE itemXXX SET time = time, value = value * 10 
SET SQL_SAFE_UPDATES=1;

```

---

<div class="post-metadata">

**Author:** ![system](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/6/6a52f2ac5d00e4c7b50471a354b3a9221188be90.png) [@system](https://community.openhab.org/u/system)\
**Post date:** [September 15, 2021, 11:42pm UTC](https://community.openhab.org/t/update-persistence-without-changing-timestamps/125215/2 "2021-09-15T23:42:48Z")

</div>

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.
