Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2006
    Posts
    97

    Unanswered: getting current time in SQL

    How can we get current time stamp along with rest of SQl values.


    Ex:

    Time col1 col2 col3

    timestamp abc 243920842 kclsjd
    timestamp dsfd 324343335 fghfdf

  2. #2
    Join Date
    Sep 2006
    Posts
    97
    please some body can help me out???

  3. #3
    Join Date
    Sep 2006
    Posts
    97
    got it

    -- Date
    SELECT current date
    FROM sysibm.sysdummy1;

    -- Time
    SELECT current time
    FROM sysibm.sysdummy1;

    -- Date-Time
    SELECT current timestamp
    FROM sysibm.sysdummy1

  4. #4
    Join Date
    Sep 2006
    Posts
    97
    select current timestamp ,rtrim(tabname),card from sysibm.sysdummy1 a,syscat.tables b where b.tabname in ('t1_OLD','t2_OLD');

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Remove the bogus "sysibm.sysdummy1" from your query. This join doesn't do anything in your case.
    Code:
    SELECT current timestamp AS timestamp,
           RTRIM(tabname) AS table_name,
           card
    FROM   syscat.tables
    WHERE  tabname IN ( 't1_OLD', 't2_OLD' )
    Note that table names in the catalog views (like SYSCAT.TABLES) are case-sensitive. You must have used delimited identifiers in the table for you query to work, i.e.
    Code:
    CREATE TABLE "t1_OLD" ( ... )
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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