Professional Web Applications Themes

Does DB2 support 'CREATE TABLE tmp SELECT * FROM EMP' ? - IBM DB2

Hi, is it possible to create tables using SELECT in DB2? Zsolt...

  1. #1

    Default Does DB2 support 'CREATE TABLE tmp SELECT * FROM EMP' ?

    Hi,

    is it possible to create tables using SELECT in DB2?


    Zsolt


    Zsolt Guest

  2. #2

    Default Re: Does DB2 support 'CREATE TABLE tmp SELECT * FROM EMP' ?

    "Zsolt Koppany" <com> wrote in message
    news:bm8ccp$oot$04$t-online.com... 
    Yes, using the CREATE TABLE AS syntax. These are Materialized Query Tables,
    unless the DEFINITION ONLY option is specified, in which case the table is
    created without any data.

    You can also use CREATE TABLE LIKE... if the new table is exactly like the
    old table.

    See the SQL Reference Vol 2 manual (version 7 only has one volume).


    Mark Guest

  3. #3

    Default Re: Does DB2 support 'CREATE TABLE tmp SELECT * FROM EMP' ?

    Note that if you use CREATE TABLE LIKE, you need a separate step to
    populate it. You can do it in one step from the Control Center.

    CREATE TABLE ADDRESS2 LIKE ADDRESS

    INSERT INTO ADDRESS2 SELECT * FROM ADDRESS


    Mark A wrote:
     
    >
    > Yes, using the CREATE TABLE AS syntax. These are Materialized Query Tables,
    > unless the DEFINITION ONLY option is specified, in which case the table is
    > created without any data.
    >
    > You can also use CREATE TABLE LIKE... if the new table is exactly like the
    > old table.
    >
    > See the SQL Reference Vol 2 manual (version 7 only has one volume).
    >
    >[/ref]

    Blair Guest

  4. #4

    Default Re: Does DB2 support 'CREATE TABLE tmp SELECT * FROM EMP' ?

    If only that would work for temporary tables, ala:

    CREATE TEMP TABLE ADDRESS2 LIKE ADDRESS

    aj

    On Sat, 11 Oct 2003 12:44:42 -0400, Blair Adamache
    <> wrote:
     
    >>
    >> Yes, using the CREATE TABLE AS syntax. These are Materialized Query Tables,
    >> unless the DEFINITION ONLY option is specified, in which case the table is
    >> created without any data.
    >>
    >> You can also use CREATE TABLE LIKE... if the new table is exactly like the
    >> old table.
    >>
    >> See the SQL Reference Vol 2 manual (version 7 only has one volume).
    >>
    >>[/ref]
    >[/ref]

    allenj@ndr.com Guest

  5. #5

    Default Re: Does DB2 support 'CREATE TABLE tmp SELECT * FROM EMP' ?

    com <com> wrote:
     

    What do you have against

    DECLARE GLOBAL TEMPORARY TABLE address2 LIKE address

    ??

    --
    Knut Stolze
    Information Integration
    IBM Germany / University of Jena
    Knut Guest

Similar Threads

  1. select next id in table?
    By Jim Michaels in forum MySQL
    Replies: 1
    Last Post: April 23rd, 04:29 AM
  2. Support of sql-92 select statement
    By Fred in forum Informix
    Replies: 7
    Last Post: November 27th, 05:50 PM
  3. How create a select box in MX
    By bobnapoli webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 2
    Last Post: September 9th, 07:51 PM
  4. Select of non DBO Table in UDF...can't do it.
    By al in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 17th, 07:28 PM
  5. How to create a table with dynamic table name
    By cathy wang in forum Informix
    Replies: 3
    Last Post: July 17th, 12:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139