This is the dilemma. Someone in the field swapped some equipment around and didnt let us know that the IP address should have been changed. The tag addresses for these 2 devices are exactly the same so both kept on trucking. Now I have about a months worth of data on each device that needs to be swapped around to the correct device.
Looking at the history tables, sqlth_te has the tag paths and each of the monthly partitions uses that tagpaths id as the key.
This is what I am thinking about doing:
-
get the tagids for the affected tags for device #1. create a new temporary tagid for each one these and do a replace in the monthly partition tables for each of the tagids with the new temp tagid for the necessary date range. (Instead of making up a tagid I may have to create new sqltags so that the system creates the tagids for me. There may be some constraints that only allow valid ids from the sqlth_te??)
-
after all of the tagids have been replaced with the temp tagids for device #1, do a replace on all of device #2’s tagids with device #1’s tagids. This should make all of the data for device #1 correct.
-
Now, I would need to do a replace on the data that I assigned the temp tagids to. Once I replaced the temp tagids with device #2’s tagids, I believe I should be good to go.
Will this method work? Any better ideas?