Inserting values in to a TIMESTAMP column
search cancel

Inserting values in to a TIMESTAMP column

book

Article ID: 37317

calendar_today

Updated On:

Products

Datacom DATACOM - AD Datacom/AD Datacom/DB

Issue/Introduction

Working with SQL timestamp fields requires that values be referenced in a specific format. As a result, if using INSERT statements, provide the timestamp value in a particular edited format, and this value is constant regardless of whether ISO, USA, EUR, or JIS string format are being used for other fields.

Environment

Release: All supported releases.
Component: SQL.

Resolution

To use an INSERT statement for a timestamp value, please follow the format as noted in the Datacom/DB SQL User Guide. This value contains the year, month, day, hour, minute, second, and microseconds. For example, to insert a row with the timestamp of 29 January 2016, at 1:34.26.184232 pm, use:

INSERT INTO tblname VALUES ( ... ,'2016-01-29-13.34.26.184232', ... );

Likewise, when retrieving a timestamp value from a table, even though the column is stored in Datacom/DB as a 10-byte binary field, it is returned in the same character form as above.