INSERT
SQL statement
Description
Inserts one or more new rows into the table specified in
RestOfInsertStatement.
Syntax
|
1 2 |
INSERT RestOfInsertStatement {USING TransactionObject} ; |
|
Parameter |
Description |
|---|---|
|
RestOfInsertStatement |
The rest of the INSERT statement (the INTO clause, |
|
TransactionObject |
The name of the transaction object that identifies |
Usage
Error handling
It is good practice to test the success/failure code after
executing an INSERT statement.
Examples
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:
|
1 2 3 4 5 |
int EmpNbr string EmpName ... INSERT INTO Employee (employee.Emp_nbr, employee.Emp_name) VALUES (:EmpNbr, :EmpName) ; |
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:
|
1 2 3 4 5 6 |
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 ; |