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