Use the Create function
- Last UpdatedFeb 10, 2023
- 3 minute read
- PI System
- PI SQL Commander Lite 2021
- Developer
For PI SQL Client, you can create a catalog, schema, view, table-valued function, or function table.
-
To create a catalog, right-click the Catalogs folder and do either one of the following:
-
Click Create Catalog, in the PI SQL Client window enter a catalog name and then click OK.
-
Click Scripts > CREATE CATALOG > New Query Editor Window and in the query editor substitute <catalog name> with the catalog name that you want.
-
-
To create a schema, right-click a catalog folder and do either one of the following:
-
Click Create Schema, in the PI SQL Client window enter a schema name and then click OK.
-
Click Scripts > CREATE SCHEMA > New Query Editor Window and in the query editor substitute <schema name> with the schema name that you want.
Note: We recommend you use a custom schema for creating your views and table-valued functions. In case a new release adds a table, view, or table-valued function that is in conflict with a custom name, the existing view or table-valued function will automatically be renamed as part of the upgrade process.
-
-
To create a view, right-click a views folder, and then click Scripts > CREATE VIEW > New Query Editor Window.

-
In the Query Editor pane, substitute <view name> with the view name that you want.
-
Define the view.
-
-
To create a table-valued function, right-click a table-valued functions folder, and then click Scripts > CREATE FUNCTION > New Query Editor Window.

-
In the Query Editor pane, substitute <function name> with the table-valued function name that you want.
-
Add the parameters for the function.
-
Define the function.
-
-
To create a function table, do either one of the following:
-
Right-click a function tables folder, and then click Scripts > CREATE FUNCTION TABLE > New Query Editor Window.

-
In the Query Editor pane, substitute <function table name> with the function table name that you want.
-
Substitute <catalog>, <schema> and <function name> with the names that you want.
-
Add the parameter data types for the function.
-
-
In a table-valued functions folder, right-click a table valued function, click Create Function Table and in the PI SQL Client window, enter a function table name or click OK or both.
The function table will be created in the function tables folder based on which table-valued function you previously selected. For example, if you selected Cooling Fan_GetSampled Value, the according function table will be ft_Cooling Fan_GetSampledValue.

-