Date/Time Functions – SYSDATETIME()

I am going to start a series of short articles or tidbits on Transaction SQL date/time functions.

Most, if not all, modern day computer systems collect data which contains dates and times.

Not only is it important to know when a sales order came in, but we should fulfill the request using some type of queue (LIFO). If if was a stack (FIFO) implementation, the first person may never get his order!

I will be exploring functions that return the current system date and time in a defined data type format. Some formats have more precision than others.

Today, I will be investigating the SYSDATETIME() function. This function takes does not take any arguments but returns a datetime2(7) data type.

The example below is a sample call to the function.

The output from the test is listed below.

In a nutshell, this function returns the current system date and time in datetime2(7) format.

Related posts

Leave a Comment