I need to create a SQL script to convert a integer field to varchar. My database is a Progress DB. This integer field (nrHoraRegistro) has a timestamp converted in integer.
Is there a way to write a query to convert it in Progress SQL ?
Kind Regards, Juliano
CodePudding user response:
Well, as a workaround I did :
SELECT right('00' to_char(floor(54671/3600)), 2) ':'
right('00' to_char(MOD(54671,3600)/60), 2) ':'
right('00' to_char(MOD(MOD(54671,3600),60)) , 2) as nrHoraRegistro
FROM PUB.XXX
CodePudding user response:
Based on an answer I have given before:
select
to_char(
timestampadd(
sql_tsi_second,
nrHoraRegistro,
curdate()
),
'hh24:mi:ss'
)
from
pub.testtable
CodePudding user response:
You can use this conversion :
SELECT (to_timestamp(54671) at time zone 'UTC')::time
It works forme the result is :
Returned value:
----------
| 15:11:11 |
----------