Multi-statement query
- Last UpdatedNov 18, 2022
- 1 minute read
- PI System
- Interfaces
This query maintains one day (GETDATE()-1) of sinusoid events in an RDBMSPI table. At the same time, this point records the number of rows in the given table (COUNT(*)).
INSERT INTO table14 (alias, timestamp, value, status, quality)
VALUES (?, ?, ?, ?, ?);
SELECT GETDATE(), COUNT(*), 0 FROM table14;
DELETE FROM table14 WHERE timestamp < GETDATE()-1;
Configure the target PI point with the following settings:
|
Point attribute |
Description |
Setting |
|---|---|---|
|
ExDesc |
Placeholders and options |
P1=" sinusoid " P2= 'sinusoid'/TS P3= 'sinusoid'/VL P4= 'sinusoid'/SS_I P5= 'sinusoid'/QE |
|
Location2 |
First row/all rows |
1 (All rows are processed) |
|
Location3 |
Data distribution strategy |
0 (Single) |
|
Location4 |
Scan class |
1 |
|
Location5 |
Exception reporting |
1 (Exception reporting is turned off) |
|
InstrumentTag |
Name of the SQL file |
Example14.SQL |
|
PointType |
Data type of PI point |
Float32 |
In the RDBMS, create a table formatted as follows:
|
Column name |
Column data type |
|---|---|
|
SQL Server data type |
|
|
timestamp |
DateTime |
|
value |
Real |
|
status |
Smallint |
|
quality |
Smallint |
|
alias, annotation |
Varchar(255) |