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:
1 2 | SELECT CURRENT_TIMESTAMP ; SELECT GETDATE(); |
Here is the result:
1 2 | 2020-11-14 12:54:19.127 2020-11-14 12:54:19.127 |
As there are no differences between these functions, It is your preference on which one to use in SQL programming.
Reference
- Read more about CURRENT_TIMESTAMP at Microsoft Docs.
- Read more about GETDATE() at Microsoft Docs.