Create a view
- Last UpdatedFeb 10, 2023
- 2 minute read
- PI System
- PI SQL Commander Lite 2021
- Developer
-
Connect to PI AF Server using PI OLEDB Enterprise or Connect to PI Data Archive using PI OLEDB Provider and expand the schema under one of the data sources.
Note: A view can only be created if PI SQL Commander Lite is connected to an OLEDB or an ODBC data source. For information about how to create a view for PI AF server using PI SQL Client, see Use the template-specific data model wizard.
-
Right-click a Views folder and then select Create View.
-
Enter an SQL statement in the query editor.
Example query for PI AF server using PI OLEDB Enterprise or PI ODBC Driver:
CREATE VIEW [NuGreen].[DataT].[New Test View]
AS
SELECT * FROM [NuGreen].[Asset].[Category]Example query for Data Archive using PI OLEDB Provider or PI ODBC Driver:
CREATE VIEW [piarchive]..[New Test View]
AS
SELECT * FROM [piarchive]..[piavg] -
In the query editor, right-click and click Execute to execute the query.
-
In the Object Explorer pane, right-click the Views folder and click Refresh to see the newly created view.