JET Database/Insert

From Wikibooks, open books for an open world
Jump to navigation Jump to search
JET Database

Introduction · Creating and connecting · Data types · Object names and constants · Data integrity · Security · Data definition language · Select · Insert · Update · Delete · Functions · Views and stored procedures · Manipulation tools · Integration and migration · Design tools

Data can be added to tables using the Insert statement. The statement takes the following basic form:

Insert Into {tablename}
    [In {external-db-path}]
    [{column-list}]
    [{select-statement} | {values-list}]
{tablename} The name of an existing table into which rows will be inserted.
{external-db-path} A Windows path to an external database in which the target table resides. The external database can be another JET database, or any other database that the JET drivers can connect to (include dBase and Paradox databases).
{column-list} A comma-separated list of columns within a pair of parentheses, specifying which columns in the target table will be populated by the Insert statement. If omitted, then all columns will be populated by the Insert statement. Any column not specified by the {column-list} will be set to NULL, unless the column has a default value set.
{select-statement} A Select statement that returns the same number of columns as the {column-list}, or the number of columns in the target table if the {column-list} is omitted.
{values-list} A comma-separated list of expressions within a pair of parentheses, providing the same number of values as there are columns in the {column-list}, or the number of columns in the target table if the {column-list} is omitted.