Forum Discussion

vuvcpg's avatar
vuvcpg
Copper Contributor
Apr 16, 2023

If I get the time twice in one SQL, is it possible to get different results?

eg:

SELECT DATEDIFF(millisecond, GETDATE(), GETDATE())

and

SELECT DATEDIFF(millisecond, GETDATE(), CURRENT_TIMESTAMP)

 

Can I get a number greater than 0 millisecond?

  • olafhelper's avatar
    olafhelper
    Bronze Contributor

     


    SELECT DATEDIFF(millisecond, GETDATE(), GETDATE())

    vuvcpg , what on earth do you expect here for a result different the 0 milliseconds? The function GETDATE() is evaluated at once, so the query can't ever return something different the 0 ms.

Resources