What is the difference between GetDate() and SysDateTime() in SQL Server 2008?

 Posted by Nagasundar_Tn on 12/3/2012 | Category: Sql Server Interview questions | Views: 10260 | Points: 40
Answer:

GetDate() and SysDateTime are used to fetch the current datetime of server. But there is a slight difference exists between these two. GetDate() used to get the time upto MilliSeconds where as SysDateTime used to get the time upto NanoSeconds.

If we run the query in Sql Server

SELECT GETDATE() [GetDate], SYSDATETIME() [SysDateTime]

The output will be

GetDate	                   SysDateTime

2012-12-03 11:28:43.500 2012-12-03 11:28:43.5004729


Asked In: NIIT interview | Alert Moderator 

Comments or Responses

Login to post response