How to Insert Values into Timestamp Column in DB2

TIMESTAMP function is one of the data type in DB2. It helps you get TIMESTAMP in your SQL Query result. This is so common in any business scenario.


All business transactions linked to TimeStamp. Every business SQL query has TIME, DATE, and TIMESTAMP. My query here to show how to insert values to TIMESTAMP Column.

When Linux Operating System Invented.
Linux started

Definition for TIMESTAMP

timestamp is a seven-part value representing a date and time by year, month, day, hour, minute, second, and microsecond, in the range of 0001-01-01- to 9999-12-31- with nanosecond precision. Timestamps can also hold timezone information.

Examples for TIMESTAMP function in DB2.

The TIMESTAMPS in your SQL Query, you can give in different formats.

The order is Abbreviation>DATE>Time

International Standards OrganizationISO2003-12-2513.30.05
IBM® USA standardUSA12/25/20031:30 PM
IBM European standardEUR25.12.200313.30.05
Japanese Industrial Standard Christian EraJIS2003-12-2513:30:05

But you need to remember that TIME is part of TIMESTAMP. Here, our focus is TIMESTAMP.

Below SQL Query is the best example to create a DB2 table that uses TIMESTAMP


The another SQL query to insert values into DB2 Table

INSERT INTO TABLE1 VALUES ( '2007-11-05-08.00.00-08:00', 

The general thumb rule:

  • A date, time, or timestamp value can be compared with another value of the same data type, a datetime constant of the same data type, or with a string representation of a value of that data type. Additionally, a TIMESTAMP WITHOUT TIME ZONE value can be compared with a TIMESTAMP WITH TIME ZONE value.

Related Posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.