Let's say I have a tag list in the system named "Tag" logging some data. I copied it's Json out to a different system, made some changes, and copied the Json back in but with the name "Tag_new". And then I deleted "Tag" and renamed "Tag_new" to "Tag".
This creates a new set of tag in the db. Is there anyway to stitch the old historian to the new tags?
If it's just that one tag, you can manually edit the historian tables.
sqlth_te contains a map of your historized tags. It has a tagpath column and an id column.
sqlt_data_x_xxxx contain the actual data, with tagid referencing the id found in sqlth_te.
Find the duplicate entry in sqlth_te, note its id, then update all tags in sqlt_data_* tables that match this id to replace their tagid with the one of your actual tag entry.
I'd also restart the historian provider: Just disable it, save, then re-enable it. This will clear and rebuild its cache.
1 Like
Tag history is linked by tag path, not by ids, so in doing what you described (delete old tag, renaming new tag to old name), the replacement tag will be linked to the same existing history from the old version of the tag. You will see in the sqlth_te table multiple entries for your tagpath with different ids, where the old versions will have a retired field set to the time they were retired (deleted/moved), and the latest where this will be NULL.