INSERT

Description

Inserts one or more new rows into the table specified in RestOfInsertStatement.

Syntax

INSERT RestOfInsertStatement 
	{USING TransactionObject} ;

Parameter

Description

RestOfInsertStatement

The rest of the INSERT statement (the INTO clause, list of columns and values or source).

TransactionObject

The name of the transaction object that identifies the database containing the table. This clause is required only for transaction objects other than the default (SQLCA).

Usage

NoteError handling It is good practice to test the success/failure code after executing an INSERT statement.

Examples

Example 1

Example 1 These statements insert a row with the values in EmpNbr and EmpName into the Emp_nbr and Emp_name columns of the Employee table identified in the default transaction object:

int EmpNbr

string EmpName

...

INSERT INTO Employee (employee.Emp_nbr,

		employee.Emp_name)

		VALUES (:EmpNbr, :EmpName) ;

Example 2

Example 2 These statements insert a row with the values entered in the SingleLineEdits sle_number and sle_name into the Emp_nbr and Emp_name columns of the Employee table in the transaction object named Emp_tran:

int   EmpNbr

string  EmpName

EmpNbr = Integer(sle_number.Text)

EmpName = sle_name.Text

INSERT INTO Employee (employee.Emp_nbr, 

		employee.Emp_name)

		VALUES (:EmpNbr, :EmpName) USING Emp_tran ;