DB2 Insert Current TimeStamp

DB2 Insert Current TimeStamp

In DB2 CURRENT TIMESTAMP is inherited as below:

CURRENT_TIMESTAMP is equivalent to specifying CURRENT TIMESTAMP

Suppose you want timestamp with specified precision then this can be referenced as CURRENT TIMESTAMP(integer) where integer can range from 0 to 12. Default precision is 6.
SYSDATE can also specified as synonym for CURRENT TIMESTAMP(0). Example:

INSERT INTO TABLE(DB_UPDATE_TIME) VALUES (CURRENTTIMESTAMP(3))

  • CURRENT_TIMESTAMP – 20 DAYS

This query will return date from 20 days ago

db2 “select date(current timestamp – 20 days) from sysibm.sysdummy1”

Reference: IBM

Leave a Reply

Your email address will not be published. Required fields are marked *