# Is there a way to have Tag History insert into a specific table instead of creating its own?

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743>\
**Category:** Ignition\
**Created:** [April 30, 2025, 5:05pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743 "2025-04-30T17:05:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kraigen94](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kraigen94](https://forum.inductiveautomation.com/u/kraigen94)\
**Post date:** [April 30, 2025, 5:05pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/1 "2025-04-30T17:05:01Z")

</div>

I have a value I want to historize, however, I want to be able to insert the value into a previously created table on my db, instead of having it create a new table. If this is not possible, is there a way to change the name of the table the tag history will create from 'sqlt\_xxx' to a custom name without breaking the connection?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [April 30, 2025, 5:08pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/2 "2025-04-30T17:08:28Z")

</div>

No.

The database tag historian uses an off the shelf database, but its inner workings should be considered opaque - you get to use your existing database, but you do not get control over the tables or their structure.

If you want control over storage of data, you must use transaction groups or scripting.

---

<div class="post-metadata">

**Author:** ![kraigen94](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kraigen94](https://forum.inductiveautomation.com/u/kraigen94)\
**Post date:** [April 30, 2025, 5:44pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/3 "2025-04-30T17:44:26Z")

</div>

Thanks for your answer. A little off-topic, but if I were to use scripting I would go for a Value Changed script, is it possible to incorporate a timed component to that script as well? For example, if the value hasn't changed in X amount of time, insert anyways.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 30, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/4 "2025-04-30T18:14:23Z")

</div>

Put your operation into a project library script function. Call that function unconditionally from the tag change event. Call that function conditionally, based last timestamp, from a gateway timer event.

(Do not perform database operations from a tag's own valueChange event unless you "fire-and-forget" with the store-and-forward system.)

---

<div class="post-metadata">

**Author:** ![Simon\_Hathout\_Willar](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Simon\_Hathout\_Willar](https://forum.inductiveautomation.com/u/Simon_Hathout_Willar)\
**Post date:** [April 30, 2025, 8:37pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/5 "2025-04-30T20:37:45Z")

</div>

Could a view help accomplish the goals of having a custom named table? (If you have pre-existing software that expects to read tag history from something named like 'history\_xxx')

---

<div class="post-metadata">

**Author:** ![kraigen94](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kraigen94](https://forum.inductiveautomation.com/u/kraigen94)\
**Post date:** [May 1, 2025, 4:30pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/6 "2025-05-01T16:30:06Z")

</div>

I don't know if the gateway timer event would work for me because I have several tags that will need to insert tinto the database on change and periodically as well.

---

<div class="post-metadata">

**Author:** ![Nol](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@Nol](https://forum.inductiveautomation.com/u/Nol)\
**Post date:** [May 1, 2025, 4:41pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/7 "2025-05-01T16:41:49Z")

</div>

You might be able to accomplish this with a transaction group as you can define the table name there.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2025, 5:32pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/8 "2025-05-01T17:32:36Z")

</div>

You need a gateway timer event to have any chance of recording periodically. Tag change events simply will not do that part for you.

---

<div class="post-metadata">

**Author:** ![kraigen94](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@kraigen94](https://forum.inductiveautomation.com/u/kraigen94)\
**Post date:** [May 1, 2025, 6:13pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/9 "2025-05-01T18:13:54Z")

</div>

and is there a way to have the gateway timer event execute the script on several tags?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2025, 6:17pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-have-tag-history-insert-into-a-specific-table-instead-of-creating-its-own/105743/10 "2025-05-01T18:17:19Z")

</div>

Sure. The timer event isn't naturally attached to any tag at all. It will simply handle the tags you code it to handle. (Use `system.tag.readBlocking()` with a list of tag paths to get a list of all QualifiedValues back.)
