How to get current system date time in SQL Server?
First thing which comes to many users is using following script.
SELECT GETDATE() AS CurrentDateTime
Above method is not the only method to retrieve the current system date time for SQL Server. SQL Server 2008 has many different function which provides current system date time in different format and little difference in details.
SELECT 'SYSDATETIME' AS FunctionName, SYSDATETIME() AS DateTimeFormat UNION ALL SELECT 'SYSDATETIMEOFFSET', SYSDATETIMEOFFSET() UNION ALL SELECT 'SYSUTCDATETIME', SYSUTCDATETIME() UNION ALL SELECT 'CURRENT_TIMESTAMP', CURRENT_TIMESTAMP UNION ALL SELECT 'GETDATE', GETDATE() UNION ALL SELECT 'GETUTCDATE', GETUTCDATE()
In SQL Server 2008, use any of the above function depending on your need.
Quick Video on the same subject
[youtube=http://www.youtube.com/watch?v=BL5GO-jH3HA]Reference : Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)