As Result Table

Description

Specifies that the columns of the new table have the same name, data type, and optionally same data, as the resulting from the fullselect.

Click here to navigate to the IBM DB2 docs page for this syntax.

Grammar Syntax

Sample Source Patterns

IBM DB2

CREATE TABLE TestTable
AS (SELECT * FROM OriginalTable) WITH NO DATA;

Snowflake

CREATE TABLE PUBLIC.TestTable
AS (SELECT * FROM OriginalTable LIMIT 0);

IBM DB2

CREATE TABLE TestTable
AS (SELECT * FROM OriginalTable) WITH DATA
INCLUDING COLUMN DEFAULTS
INCLUDING IDENTITY;

Snowflake

CREATE TABLE PUBLIC.TestTable
AS (SELECT * FROM OriginalTable)
-- ** MSC-WARNING - MSCEWI1002 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE.  **
--INCLUDING COLUMN DEFAULTS
-- ** MSC-WARNING - MSCEWI1002 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE.  **
--INCLUDING IDENTITY
                  ;";

  1. MSCEWI1002 : NOT APPLICABLE IN SNOWFLAKE

Last updated

Was this helpful?