How to Create table using like but with modifications?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • db2maf
    New Member
    • Sep 2010
    • 1

    How to Create table using like but with modifications?

    Hi Gurus,

    My system: DB2 v9.5_FP0 (Windows).

    I have two questions that I seek help with:

    1. I want to create a table using the following:
    - db2 create table SCHEMA.DBCFG like SYSIBMADM.DBCFG
    however, I want to add a 'snapshot_times tamp' column. Is it possible to achieve that with the create command above or do I have to perform an 'alter table' post the 'create like' command.

    2. Having created the table in step 1. above I want to perform inserts using the following command with the inclusion of 'snapshot_times tamp':
    insert into SCHEMA.DBCFG select * from sysibmadm.dbcfg
    (I'm not sure how to insert the timestamp with this command).

    Could you please provide some examples.

    Look forward to your responses,
    Thanking you in advance.
  • Anand Kaushal
    New Member
    • Oct 2010
    • 6

    #2
    1. You'll have to ALTER it seperately.

    2. insert into SCHEMA.DBCFG select a.*, current timestamp from sysibmadm.dbcfg a

    Comment

    Working...