INSERT Command (SQL)

Help Contents

Introduction

The INSERT statement adds one or more new rows to a database table. The format of the INSERT statement is:

insert-statement ::=
  INSERT INTO table-name
  [ ( column {, column } ) ]
  insert-source

insert-source ::=
  DEFAULT VALUES |
  table-value-constructor |
  query-expression

Remarks

In Fernhill SCADA, the INSERT Statement can only be used to insert rows into a Database Table Tag.

The table-name must be qualified by the schema name DatabaseTable.

Examples

  1. Insert a new row into a Database Table Tag with default values:
    INSERT INTO DatabaseTable.BatchResults DEFAULT VALUES
  2. Insert a new row into a Database Table Tag with defined values:
    INSERT INTO DatabaseTable.TagSnapshot (EventTime, Flow, Level)
    VALUES (CURRENT_TIMESTAMP, 12.7, 1.2 )

    The CURRENT_TIMESTAMP Function returns the current date and time.

  3. Insert a new row into a Database Table Tag with values from a query:
    INSERT INTO DatabaseTable.AlarmCounts (AlarmState, AlarmCount)
    SELECT StateAsText, COUNT(*) FROM AlarmEvent.Alarms GROUP BY StateAsText

Further Information

Fernhill SCADA .NET Framework Data Provider

To learn about the .NET Framework Data Provider for Fernhill SCADA (FernhillSoftware.Data.FernhillScadaClient).

ODBC driver

To learn about the ODBC driver in Fernhill SCADA.

SQL Test Tool

To learn about the SQL Test Tool.

Glossary

For the meaning of terms used in Fernhill SCADA.