Friday, March 29, 2013
Sybase IQ equavalent for Oracle PL/SQl subtract dates
It'is realy unique and easy to substract dates in Oracle.
If you select
SELECT TO_DATE ('01/02/2013 11:07:16','DD/MM/YYYY HH24:MI:SS') - TO_DATE('01/02/2013 11:03:37','DD/MM/YYYY HH24:MI:SS') FROM DUAL;
Result is:
0,00253472222222222
To achive same result in Sybase IQ correct syntax is:
SELECT CONVERT(NUMERIC(16,10), DATEDIFF(SECOND, CONVERT(TIMESTAMP, '2013-02-01 11:03:37'), CONVERT(TIMESTAMP, '2013-02-01 11:07:16'))) / 60 / 60 / 24
DATEDIFF: Datepart, Small date, Big date returns: INT
Tric is converting datediff result to numeric :)
0 comments:
Post a Comment