GETDATE() Vs CURRENT_TIMESTAMP In SQL Server

GETDATE() vs CURRENT_TIMESTAMP in SQL Server

There is not much of a difference between GETDATE() and CURRENT_TIMESTAMP. CURRENT_TIMESTAMP is a nondeterministic function and GETDATE()’s ANSI SQL equivalent. Similar to GETDATE() this will also return the current timestamp of the database server in datetime datatype. Both CURRENT_TIMESTAMP and GETDATE() can be used interchangeably,

Here is the sample SQL script of using these functions:

SELECT CURRENT_TIMESTAMP;
SELECT GETDATE();

Here is the result:

2020-11-14 12:54:19.127
2020-11-14 12:54:19.127
GETDATE() Vs CURRENT_TIMESTAMP In SQL Server

As there are no differences between these functions, It is your preference on which one to use in SQL programming.

Reference


Related Articles & Tools

Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.