Moving data from a SQL server table to an extension table
- Last UpdatedMar 20, 2025
- 1 minute read
The following queries show how to insert manual data into a normal SQL Server table and then move it into the History extension table.
First, insert the data into the SQL Server table. The following query inserts two minutes of existing data for the SysTimeSec tag into the ManualAnalogHistory table:
INSERT INTO ManualAnalogHistory (DateTime, TagName, Value, Quality, QualityDetail, wwTagKey)
SELECT DateTime, TagName, Value, Quality, QualityDetail, wwTagKey
FROM History WHERE TagName = 'SysTimeSec'
AND DateTime >= '20050329 12:00:00'
AND DateTime <= '20050329 12:02:00'
Then, create a manual tag using the Operations Control Management Console. For a manual tag, "MDAS/Manual Acquisition" is specified as the acquisition type. Be sure to commit the changes to the system. In this example, a manual analog tag named MDAS1 was created.
Finally, insert the data from the ManualAnalogHistory table into History:
INSERT INTO History (TagName, DateTime, Value, QualityDetail)
SELECT 'MDAS1', DateTime, Value, QualityDetail FROM ManualAnalogHistory
WHERE TagName = 'SysTimeSec'
AND DateTime >= '20050329 12:00:00'
AND DateTime <= '20050329 12:02:00'