The INSERT statement inserts new rows into a table. You can insert as many rows as needed.
LSQL INSERT INTO tablename [(columnlist)][[VALUES(list)] [querystatement]]
|
Operand |
Explanation |
|---|---|
|
columnlist |
The column names that store the values specified with valuelist. If you do not specify columnlist values, the SQL server stores the values into the columns in the order in which they were defined on the CREATE TABLE statement for this table. |
|
querystatement |
A query statement that retrieves the values to be inserted into the table. This can be any valid search criteria. |
|
tablename |
The name of the table into which you are inserting a row. |
|
VALUES(list) |
The column values for the new row. A value can be a character string, a numeric string, or a host variable. Values in the list are separated by commas. |
Notes:
Examples
LSQL INSERT INTO APPLICATIONS (APPL_ID,USER_ID,UPDATE,STATUS)
VALUES ('APPL29','TSOUSR29', DATE '2002‑03‑13','UP')
Note: The DATE data type definition precedes the literal date value. See the description of the Select Statement for more details about the DATE, TIME, and TIMESTAMP data types. Also, that the column values match the order in which the columns appear in the table, so the column list could have been left out.
LSQL INSERT INTO APPLICATIONS (APPL_ID, STATUS) VALUES ('APPL29', 'UP')
INSERT INTO APPLICATIONS SELECT * FROM NEWAPPS WHERE USER_ID
IN ('TSOUSR1', 'TSOUSR2', 'TSOUSR8')
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |