Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    30

    Unanswered: Adding a column with default as current timestamp

    Hi,

    I am new to Db2 7.1 for z/OS1.2.
    Can any one give me the syntax for adding a timestamp column to an existing table and defaulting it to current timestamp. I tried to do different combinations, it didnt worked. Can I alter an existing timestamp column to default to current timestamp. Please give me the syntax for this option too.

    I appreciate your help
    Thanks
    Santhi

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

    Re: Adding a column with default as current timestamp

    Please refer the SQL Reference
    (Apologies ... I am weak in syntax)

    Cheers
    Sathyaram

    Originally posted by santhip
    Hi,

    I am new to Db2 7.1 for z/OS1.2.
    Can any one give me the syntax for adding a timestamp column to an existing table and defaulting it to current timestamp. I tried to do different combinations, it didnt worked. Can I alter an existing timestamp column to default to current timestamp. Please give me the syntax for this option too.

    I appreciate your help
    Thanks
    Santhi
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jan 2004
    Location
    Tallahassee, FL, USA
    Posts
    96
    Here it is

    alter table creator.tablename add colname timestamp not null with default current timestamp;

    --Lekharaju Ennam

  4. #4
    Join Date
    Nov 2003
    Posts
    30
    thanks alot

  5. #5
    Join Date
    Nov 2003
    Posts
    30

    Re: Adding a column with default as current timestamp

    Its alright. I will check the docs.
    Thanks anyway.

    Originally posted by sathyaram_s
    Please refer the SQL Reference
    (Apologies ... I am weak in syntax)

    Cheers
    Sathyaram

Posting Permissions

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