Insert original non-streamed data
- Last UpdatedFeb 27, 2025
- 1 minute read
You insert original data into history by specifying ORIGINAL for the value of the wwVersion parameter in a Transact-SQL INSERT statement.
You can insert original data for both I/O Server tags and non-I/O Server tags. However, to insert original data for I/O Server tags, the AllowOriginals system parameter must be set to 1. For more information, see Edit system parameters.
If original data is already stored in the history blocks with the same timestamps as the data you are inserting, the system retains the first set of original values and adds the second set of original values as well, resulting in multiple original values for the same timestamps. If you specify to retrieve original values, there is no way to determine the order in which the values were inserted. In a case such as this, it is better to insert revision data, if the added performance overhead is not a problem.
The following query inserts an original value for 'NonIOTag1' into history:
INSERT INSQL.Runtime.dbo.AnalogHistory (DateTime, TagName, Value, OPCQuality, wwVersion)
VALUES('2002-11-11 16:05:10', 'NonIOTag1', 10, 192, 'ORIGINAL')