Tip of the Day : Similarities and Differences Between GETDATE and SYSDATETIME Date Functions

Welcome to SQL Server Helper !!!

This site is intended for those who are beginning to use SQL Server as part of their day-to-day activities.  You will find in this site a collection of useful functions, triggers, stored procedures and tips and tricks related to SQL Server.

Should you have any comments or questions regarding this site or if you want to ask SQL Server-related questions, e-mail us here.

We hope we are able to help and we are glad to help!!!

SQL Server Tip of the Day - April 20, 2019

Similarities and Differences Between GETDATE and SYSDATETIME Date Functions

Prior to SQL Server 2008, there were only three functions that return the current system date and time of the computer on which the instance of SQL Server is running, namely CURRENT_TIMESTAMP, GETDATE and GETUTCDATE.  Beginning with SQLS erver 2008, three other date functions were introduced namely SYSDATETIME, SYSDATETIMEOFFSET and SYSUTCDATETIME.

The following article shows the similarities between the GETDATE() date function and the SYSDATETIME() date function.

Similarities

  • Returns the current date and time of the computer on which the instance of SQL Server is running.
  • The time zone offset is not included on both functions.
  • Both functions do not accept a parameter.
  • Both functions are nondeterministic functions. Views and expressions that reference these functions in a column cannot be indexed.

Differences

GETDATE()

SYSDATETIME()

Returns a DATETIME value

Returns a DATETIME2(7) value

Returns less fractional seconds precision, only 3 decimal places.

Returns more fractional seconds precision, up to 7 decimal places.

Accuracy is up to 0.00333 seconds.

Accuracy is up to 100 nanoseconds.

Available from SQL Server 2000 and onwards.

Available only from SQL Server 2008 and onwards.

SQL Server 2012

SQL Server 2008

User-Defined Functions

Date Functions

A collection of useful user-defined functions that deal with dates.

String Functions

A collection of useful user-defined functions that deal with strings (varchar/char/nvarchar/nchar).

Tree Functions

A collection of useful user-defined functions that deal with tree or hierarchical design structures.

Table-Valued Functions

A collection of useful table-valued user-defined functions that can be used to join with other tables.

SQL Server Built-in Functions

A reference to all built-in functions available within SQL Server grouped into categories.

Tips and Tricks

A collection of useful SQL Server-related tips and tricks:

SQL Server Error Messages

A list of SQL Server error messages and for certain error messages, discusses ways on how to solve the error or work around them:

Frequently Asked Questions