Difference Between CURRENT_TIMESTAMP and GETDATE() in SQL Server

Are both CURRENT_TIMESTAMP and GETDATE() the same in SQL Server?

Of course, both CURRENT_TIMESTAMP and the GETDATE() perform a similar functionality, but a lot of time most of the Oracle/MySQL developers feel tricky about it.

Most often while writing any SELECTs or in the Stored Procedures, I often tend to prefer GETDATE() rather than CURRENT_TIMESTAMP. And as far as I have seen, most of the developers and DBAs are much familiar in using the GETDATE().

One Difference between CURRENT_TIMESTAMP and GETDATE()

CURRENT_TIMESTAMP -  CURRENT_TIMESTAMP is an ANSI SQL function, which retrieves the date and time that is set on the system on which SQL instance is running.

SELECT CURRENT_TIMESTAMP









GETDATE() – GETDATE() is the T-SQL genre of the same function, which again retrieves the date and time that is set on the system on which SQL instance is running. 

SELECT GETDATE() 









Further, in case a column in a table is set as CURRENT_TIMESTAMP, then the function gets converted to GETDATE() if the code is generated manually from the SSMS.

Related interview questions to refer:

0 comments:

Post a Comment