iSeries DB2 -- CURRENT_TIMESTAMP -> Decimal(14) in SQL
Posted on 2007-11-28
I am configuring a tool that, at a particular point, executes a SQL statement on a DB. It is that generic ... my SQL statement can be anything.
I need a SQL statement that will put the current date / time into a particular field of a DB2 table on an AS400 / iSeries system.
I have Update TheTable Set TheField = CURRENT_TIMESTAMP Where ...
That errors out, however b/c TheField is of type DECIMAL (14). My customer uses those for date /times. The date / time would be encoded as 20071126143422
That outfit's programmer says I should generate the number using:
HOUR (current timestamp)*10000+
Is there no better way? That is extremely unwieldy.