In SQL Server 2005 (and previous versions) one would use GETDATE() to get the current date and time. In SQL Server 2008 this is still possible, but one can also use SYSDATETIME(). So what is exactly the difference?
The function GETDATE() returns the seconds part of the time in three fractions. The function SYSDATETIME() however returns the seconds part of the time in seven fractions. This is demonstrated in the following example:
The function GETDATE() returns the seconds part of the time in three fractions. The function SYSDATETIME() however returns the seconds part of the time in seven fractions. This is demonstrated in the following example:
select 'The current date and time is: ' , GETDATE() select 'The current date and time is: ' , SYSDATETIME()
The current date and time is: 2008-08-21 16:28:50.340 The current date and time is: 2008-08-21 16:28:50.3406250
Thanks
Alok Kumar Sharma
No comments:
Post a Comment