In some cases, a database application may need to add specific data to the data source with which it is interacting. In both embedded SQL and ODBC applications, the INSERT SQL statement is used to add one or more rows of data to a data source.
You can use the following syntax to perform a multiple-record append query:
INSERT INTO targettablename
SELECT source.fieldlist
FROM tableexpression
To perform a single-record append query, you can use:
INSERT INTO tablename fieldlist
VALUES (valueslist)
If values are provided for all fields in the table (in the VALUES clause), fieldlist does not have to be provided. However, if the number of values in the VALUES clause does not match the number of columns in the table, or if values in the VALUES clause are to be placed in specific columns in the table, column names must be explicitly stated (in the fieldlist). Depending upon how a table was defined, NULL or some predefined default value will be inserted into columns for which no corresponding value is provided.
If your destination table contains a primary key, make sure you append unique, non-Null values to the primary key field or fields; if you don't, the DBMS engine will not append the records.
If you append records to a table with a Counter field, do not include the Counter field in your query.