How to insert value in TIMESTAMP

book

Article ID: 37317

calendar_today

Updated On:

Products

CA Datacom - DB CA Datacom CA Datacom - AD CA Datacom - Server CA CIS CA Common Services for z/OS CA 90s Services CA Database Management Solutions for DB2 for z/OS CA Common Product Services Component CA Common Services CA Datacom/AD CA ecoMeter Server Component FOC CA Easytrieve Report Generator for Common Services CA Infocai Maintenance CA IPC Unicenter CA-JCLCheck Common Component CA Mainframe VM Product Manager CA Chorus Software Manager CA On Demand Portal CA Service Desk Manager - Unified Self Service CA PAM Client for Linux for zSeries CA Mainframe Connector for Linux on System z CA Graphical Management Interface CA Web Administrator for Top Secret CA CA- Xpertware

Issue/Introduction

Introduction:

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

Instructions: 

To use an INSERT statement for a timestamp value, please follow the format as noted in the CA 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, you would 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 CA Datacom/DB as a 10-byte Binary field, it is returned in the same character form as above.

Additional Information:

For more information about the use of the Timestamp data type, please refer to the following Guides:

CA Datacom/DB version 14.02 SQL User’s Guide

CA Datacom/DB version 15.0 SQL User’s Guide

As always, please contact CA Technologies support for CA Datacom if you have further questions.

Environment

Release:
Component: DB