Skip to Content

CURRENT_TIMESTAMP Microseconds resolution

Hi,

When I try this command from SQL console, I get a resolution till milliseconds (see attached screen).

Do you know if it is possible to increase the resolution till microseconds?

According to the documentation I should be able to get a detail of 7 decimal digits, but after the first three digits all others are 0.

Thanks

Francesco

SELECT TO_VARCHAR(CURRENT_TIMESTAMP, 'YYYY-MM-DD HH24:MI:SS.FF7') "to timestamp" FROM DUMMY

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 28, 2014 at 06:30 AM

    Hi Francesco,

    > According to the documentation I should be able to get a detail of 7 decimal digits, but after the first three digits all others are 0.

    Where did you find this info? I don't think CURRENT_TIMESTAMP or NOW() will return the resolution till microseconds. You cannot find this info from CURRENT_TIMESTAMP - SAP HANA SQL and System Views Reference - SAP Library or NOW - SAP HANA SQL and System Views Reference - SAP Library.

    However it's true in SAP HANA that the format of TIMESTAMP is "YYYY-MM-DD HH24:MI:SS.FF7" You can find it from Data Types - SAP HANA SQL and System Views Reference - SAP Library

    The format of TIMESTAMP and the result of CURRENT_TIMESTAMP are two different things.

    CREATE COLUMN TABLE TT (T TIMESTAMP);
    INSERT INTO TT VALUES (TO_TIMESTAMP('2014-10-28 14:00:00.1234567', 'YYYY-MM-DD HH24:MI:SS.FF7'));
    INSERT INTO TT VALUES (CURRENT_TIMESTAMP);
    SELECT TO_VARCHAR(T, 'YYYY-MM-DD HH24:MI:SS.FF7') "to timestamp" FROM TT;
    

    Best regards,

    Wenjun


    Capture.PNG (5.4 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 28, 2020 at 08:23 PM

    the question is still open.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.