SQL SYSDATETIME() Function
SQL SYSDATETIME() function is also used to get the current time of the System on which the instance of SQL Server is running. SYSDATETIME() function provides more fractional seconds precision compared to the GETDATE() function.
We can fetch the TIME part from the DATE and TIME value returned from the SYSDATETIME() function as below:
Syntax
The SYSDATETIME() function syntax is:
SYSDATETIME()
Example
In this example, we use the SYSDATETIME() function in SQL to get the current date and time.
Query
SELECT SYSDATETIME() 'Current TIME using SYSDATETIME()'
Output
How to Get Current Date and Time in SQL?
There are many built-in functions to get the current date and time in SQL. In this article, we will discuss how to get the current date and time in SQL with examples.