Any way to copy the history of one tag to another?

Good Afternoon,

I’m currently tasked with creating a simulator based off of live values we have in our system already. The idea is to copy a set of tags from live values, then change the behavior of some of those new tags in order to not mess with any of the live values we have. I’ve been able to copy the tags, but I was curious if there might be a straight forward way to copy the trending of the live tags at the moment they’re copied and tie them to the newly created tags?


What i would do is create your copies of the original tags, create another historical provider and set your copied tags to the new provider. Then open your database tool, MSSQLMS, MySQL Workbench etc. You can copy rows from one table to another, but you will need make sure you change your tag ID’s if they don’t match in both providers, tag id’s are found in the sqlth_te table. The historical data is in the sql_???_data table, ??? is going to vary if you have partitioning on. My test tables don’t so its just sqlth_1_data.

This is an example query where i am copying just one tag’s data, tagid 42 in the original historical data, and tagid 2 in the new one.

INSERT INTO tag_db1.sqlth_1_data (tagid, intvalue,floatvalue,stringvalue,datevalue,dataintegrity,t_stamp)
SELECT 2, intvalue,floatvalue,stringvalue,datevalue,dataintegrity,t_stamp
FROM tag_db2.sqlth_1_data
WHERE tagid = 42