SELECT...INTO Statement (SQL Only)

See AlsovbhowSELECTINTOSee                 ExamplevbhowSELECTINTOEx>Low

Description

You can use SELECT...INTO to create a make-table query.  Use make-table queries to archive records, make backup copies of your tables, or make copies to export to another database or use as a basis for reports that display data from a particular point in time.  For example, you might produce a Monthly Sales by Region report by running the same make-table query each month.

Notes

         The SELECT...INTO statement has the following syntax:

    SELECT fieldlist INTO newtablename

         The argument fieldlist is a list of fields that will be copied into the new table.  If fieldlist contains more than one field, separate the field names with commas.

         The argument newtablename is the name of the table created by the query.  If the new table name you enter or select is the same as the name of an existing table. the structure and data of the old table is replaced with those of the new table.

         You may want to define a primary key index for the new table.  When you create the table, the fields in the new table inherit the data type and field size of each field in the query's underlying tables, but no other field or table properties are transferred.

         Use the IN clause to create the new table in another database.

         To add data to an existing table, use the INSERT INTO statement instead to create an append query.