Object: The goal of this exercise is to practice the generation of PI OLEDB provider queries. Whether the application is using PI OLEDB Provider directly or using it through the PI ODBC Driver or PI JDBC Driver, the queries themselves are the same.
Use the following resources:
- Write queries using PI OLEDB Provider Schema
- Accessing the PI SQL Query Compendiums and Sample Queries
- Querying Digital State Values in PI OLEDB Provider
As well as these additional resources:
- Install and test PI OLEDB Provider and PI OLEDB Enterprise
- PI SQL Commander
- The PI OLEDB Provider User Guide's explanation of catalogs (page 125-171)
- General SQL Training - w3schools
Reactors in a monitored plant have sensor values written to the PI Data Archive via an OSIsoft interface, however the current operating zone of the reactor has not been written to PI. The history of these zones for these reactors is, however, stored in a SQL database, and operations would like to get this backfilled into the PI Data Archive. The PI admins would like for the SQL application to create the tags and import the data history.
For each step of the following scenario, produce a PI OLEDB Provider query that performs the requested action:
1. Confirm that the following tag does not exist: "ReactorOpZone"
2. Create a digital state set called OperatingZones that contain the following five values: "Free", "Load", "Reaction", "Unload", "Clean"
3. Create the digital tag from step 1, pointing it to this new digital state set
4. Backfill the data by writing the following values:
5. Query this time range and confirm that the values were input correctly
6. It's been decided that "Free" should be changed to "Empty", so the digital state needs to be changed.
7. Execute the query in step 5 again; does anything need to be changed?
Have questions? Ask the community
When you are ready, compare your answers with the Solution: Making PI OLEDB Provider Queries - Writes