![]() |
![]() |
The SQL Procedure |
Restriction: | You cannot use INSERT INTO on a table that is accessed with an engine that does not support UPDATE processing. |
Featured in: | Creating a Table and Inserting Data into It |
![]()
|
![]()
|
![]() <(column<, ...column>)> query-expression; |
Arguments |
specifies the column into which you are inserting rows.
specifies a PROC SQL view into which you are inserting rows. proc-sql-view can be a one-level name, a two-level libref.view name, or a physical pathname that is enclosed in single quotation marks.
See query-expression.
specifies a SAS/ACCESS view into which you are inserting rows.
See sql-expression.
Restriction: | You cannot use a logical operator (AND, OR, or NOT) in an expression in a SET clause. |
specifies a PROC SQL table into which you are inserting rows. table-name can be a one-level name, a two-level libref.table name, or a physical pathname that is enclosed in single quotation marks.
is a data value.
While it is possible to recursively reference the target table of an INSERT statement, doing so can cause data integrity problems and incorrect results. Constructions such as the following should be avoided:
proc sql; insert into a select var1, var2 from a where var1 > 0;
Methods for Inserting Values |
| |
| |
|
Note: If the INSERT statement includes an optional list of column names,
then only those columns are given values by the statement. Columns that are
in the table but not listed are given missing values.
Inserting Rows through Views |
You can insert one or more rows into a table through a view, with some restrictions. See Updating PROC SQL and SAS/ACCESS Views in the SAS 9.2 SQL Procedure User's Guide.
Adding Values to an Indexed Column |
If an index is defined on a column and you insert a new row into the table, then that value is added to the index. You can display information about indexes with
the CONTENTS statement in the DATASETS procedure. See the CONTENTS Statement.
the DICTIONARY.INDEXES table. See Accessing SAS System Information Using DICTIONARY Tables in the SAS 9.2 SQL Procedure User's Guide SAS 9.2 SQL Procedure User's Guide for more information.
For more information on creating and using indexes, see the CREATE INDEX Statement.
![]() |
![]() |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.