# Sqlth\_te: Update the "id" manually

**URL:** <https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835>\
**Category:** Ignition\
**Created:** [February 1, 2021, 7:10pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835 "2021-02-01T19:10:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SaravanaKumar.S2](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@SaravanaKumar.S2](https://forum.inductiveautomation.com/u/SaravanaKumar.S2)\
**Post date:** [February 1, 2021, 7:10pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/1 "2021-02-01T19:10:21Z")

</div>

Dear @Kevin.Herron / @Kevin.McClusky,

We have already a tag historian developed (Using Delphi) and used it for a long time.  
Due to this, we have a reference ID for each DCS signal. All our internal applications are using the aforementioned reference ID’s.

Now we are migrating to Ignition based historian. With this in mind, we wanted to use the old reference ids for all our DCS tags.

Is there a way to manually update the **“id”** column in **“sqlth\_te”** table?

Thanks!

---

<div class="post-metadata">

**Author:** ![brandon1](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@brandon1](https://forum.inductiveautomation.com/u/brandon1)\
**Post date:** [February 1, 2021, 7:35pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/2 "2021-02-01T19:35:14Z")

</div>

I can tell you that the historian by default will generate new ids automatically all the time. That is why there is a retired column to mark when a tag path gets retired. So you could have 10 id’s corresponding to one tagpath.

---

<div class="post-metadata">

**Author:** ![SaravanaKumar.S2](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@SaravanaKumar.S2](https://forum.inductiveautomation.com/u/SaravanaKumar.S2)\
**Post date:** [February 2, 2021, 2:50am UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/3 "2021-02-02T02:50:43Z")

</div>

Thanks @brandon1 🙂

I agree, But can we generate our own ID’s?

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [February 2, 2021, 3:41am UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/4 "2021-02-02T03:41:17Z")

</div>

As @brandon1 said, you could end up with multiple rows for the same tagpath but each row would have its own unique id. The id values in sqlth\_te have to be unique for each row, so you cannot force two rows with the same tagpath to the same id value. So if you ever retire a tag and then re-add at a later date, you would not be able to set both rows to the same id value.

What MIGHT be worth trying is to create an intermediate table that has your old reference id and the tagpath that should be associated with it, you could then JOIN this new table to the sqlth\_te table on matching tagpaths. This will allow you to convert from ignition ids to your old reference ids and vice versa. If tagpaths change, you could add additional rows for the old reference ids in this new table, making it a many-to-many relationship table.

There is probably a better option, but just what came to mind…

---

<div class="post-metadata">

**Author:** ![SaravanaKumar.S2](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@SaravanaKumar.S2](https://forum.inductiveautomation.com/u/SaravanaKumar.S2)\
**Post date:** [February 2, 2021, 4:38am UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/5 "2021-02-02T04:38:44Z")

</div>

Thanks, 🙂 @WillMT10

I have tried a similar solution, I think this should work for the requirement. As you suggested I should maintain the old ref number and tag path in the mapping table.

In the **sqlth\_te** table I have inserted a reference number column (This will be the foreign key)

Am I going in the right direction?

Regards,  
Saravanan.

---

<div class="post-metadata">

**Author:** ![brandon1](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@brandon1](https://forum.inductiveautomation.com/u/brandon1)\
**Post date:** [February 2, 2021, 1:04pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/6 "2021-02-02T13:04:35Z")

</div>

All I can say is everything for native tag history has to use tagpaths. So I guess if you were running a query on that intermediate table to produce the correct tag path it would work. I just don’t see what the real payoff is. In Ignition all tags used for animates are going to be paths not a reference ID. So why not just document what those reference IDs were and just not use them at all in the new system? Just my two cents.

---

<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:** [February 2, 2021, 1:53pm UTC](https://forum.inductiveautomation.com/t/sqlth-te-update-the-id-manually/42835/7 "2021-02-02T13:53:11Z")

</div>

Concur. Avoid editing sqlth\_te, as your reference IDs won’t be copied when Ignition retires an entry. Instead, create a separate index table of your reference ID and the corresponding Ignition tag path. Perform lookups and/or joins as needed.
