Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Location
    Des Moines,IA
    Posts
    21

    Exclamation Unanswered: Create table issue ?!?!?

    Hi

    Here is the issue...
    Is there way that can create table & populates data from an existing table with some where conditions.

    I tried the following but it gives error..

    create table schema.newtbl as (select * from schema.oldtbl where col1 = 'dbforum');

    The error say it's expecting "definition only"
    But i want DDL with data on particular where conditions other than using "INSERT"

    Any bodies response is apprciated

    thanks
    Sreeni.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Create table issue ?!?!?

    You cannot do this using CREATE TABLE Statement ...

    But you can use ixf format EXPORT/IMPORT ...
    Have a look at these commands in the command reference ...

    If you want to move multiple tables, db2move will be a better choice ...

    Cheers

    Sathyaram

    Originally posted by sakalasreenu
    Hi

    Here is the issue...
    Is there way that can create table & populates data from an existing table with some where conditions.

    I tried the following but it gives error..

    create table schema.newtbl as (select * from schema.oldtbl where col1 = 'dbforum');

    The error say it's expecting "definition only"
    But i want DDL with data on particular where conditions other than using "INSERT"

    Any bodies response is apprciated

    thanks
    Sreeni.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jul 2003
    Location
    Des Moines,IA
    Posts
    21

    Exclamation

    Thank you very much for quick reply.
    I am aware of import/export...
    How can i use db2move ?
    Can you please give some simple example if you don't mind.

    thank you very much.
    Sreeni.

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You could also do this with 2 seperate statements:

    1. create table schema.newtbl like schema.oldtbl;

    2. insert into schema.newtbl select * from schema.oldtbl where col1 = 'dbforum';

    You would have to create any indexes seperately.

Posting Permissions

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