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

Copper Contributor

eg:

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

and

SELECT DATEDIFF(millisecond, GETDATE(), CURRENT_TIMESTAMP)

 

Can I get a number greater than 0 millisecond?

1 Reply

 


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.