Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    30

    Unanswered: Equivalent of Getdate() for DB2

    Hi,
    I was looking for a DB2 functions which was equivlent of Getdate() from SQL SERVER.

    Lets say I have table TBLA (Name varchar(45), DOB timestamp)
    If I wanted to insert a row in the table I would write
    insert into TBLA values ('John Doe',getdate())

    How can I write the same insert statement in DB2.

    Thanks for your time
    -Soumil

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

    Re: Equivalent of Getdate() for DB2

    Are you talking about the CURRENT TIMESTAMP special register ?
    If so

    insert into tbla values('John Doe',current timestamp)

    will do the trick

    Sathyaram

    Originally posted by soumil
    Hi,
    I was looking for a DB2 functions which was equivlent of Getdate() from SQL SERVER.

    Lets say I have table TBLA (Name varchar(45), DOB timestamp)
    If I wanted to insert a row in the table I would write
    insert into TBLA values ('John Doe',getdate())

    How can I write the same insert statement in DB2.

    Thanks for your time
    -Soumil
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jul 2003
    Posts
    30

    Re: Equivalent of Getdate() for DB2

    Originally posted by sathyaram_s
    Are you talking about the CURRENT TIMESTAMP special register ?
    If so

    insert into tbla values('John Doe',current timestamp)

    will do the trick

    Sathyaram
    Thanks for your input.
    Can I use it in the following format

    insert into TBLA (fname, DOB)
    select name , current timestamp from tblB;

    Thanks
    -Soumil

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

    Re: Equivalent of Getdate() for DB2

    Absolutely ...

    Cheers
    Sathyaram

    Originally posted by soumil
    Thanks for your input.
    Can I use it in the following format

    insert into TBLA (fname, DOB)
    select name , current timestamp from tblB;

    Thanks
    -Soumil
    Visit the new-look IDUG Website , register to gain access to the excellent content.

Posting Permissions

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