SELECT INTO

When the INTO clause is specified with a SELECT, the results of the query are inserted into the specified table. The table will be created on SELECT INTO processing and thus may not exist prior execution. The INTO clause immediately precedes the FROM clause.

Usage

SELECT * INTO table FROM ...
SQL

Syntax Rules

  • The INTO clause is logically applied last in processing, after the ORDER BY and LIMIT clauses;
  • The Data Virtuality Server's support for SELECT INTO is similar to MS SQL Server. The target of the INTO clause is a table where the result of the remaining SELECT command will be inserted;
  • SELECT INTO should not be used with 
    • set operations (UNION, INTERSECT, EXCEPT)
    • common table expressions (WITH)

INSERT INTO

When the INTO clause is specified with an INSERT, the results of the query are inserted into the specified table. The table will not be created on INSERT INTO processing and thus must exist prior execution. The INTO clause immediately follows the INSERT clause.

Usage

INSERT INTO table (column,...) VALUES (value,...)
-- or
INSERT INTO table (column,...) SELECT * FROM x
SQL