I am not aware of any functions date function deprecation in 2008. There are new functions added to compliment new datatypes.
(a) SYSDATETIME() : Returns the current database system timestamp as a datetime2(7) value. The database time zone offset is not included. This value is derived from the operating system of the computer on which the instance of SQL Server is running.
select SYSDATETIME() : Result : 2008-02-10 10:12:54.8750000
(b) SYSDATETIMEOFFSET () : Returns the current database system timestamp as a datetimeoffset(7) value
select SYSDATETIMEOFFSET() --Result : 2008-02-10 10:12:09.6406250 +05:30
(c) SYSUTCDATETIME() : Returns the current database system timestamp as a datetime2(7) value. The database time zone offset is not included.
Select SYSUTCDATETIME() –- Result 2008-02-10 04:44:52.1875000
(d) SWITCHOFFSET() : Returns a datetimeoffset value that is changed from the stored time zone offset to a specified new time zone offset.
SELECT SWITCHOFFSET ('2008-02-10 7:45:50.71345 -5:00', '-08:00') as SWITCHOFFSETResult
(e) TODATETIMEOFFSET () : Changes the time zone offset for a date and time value. This function can be used to update a datetimeoffset column.
SELECT TODATETIMEOFFSET ('2008-02-10 7:45:50.71345 -5:00', '-08:00') as TODATETIMEOFFSET
(a) SYSDATETIME() : Returns the current database system timestamp as a datetime2(7) value. The database time zone offset is not included. This value is derived from the operating system of the computer on which the instance of SQL Server is running.
select SYSDATETIME() : Result : 2008-02-10 10:12:54.8750000
(b) SYSDATETIMEOFFSET () : Returns the current database system timestamp as a datetimeoffset(7) value
select SYSDATETIMEOFFSET() --Result : 2008-02-10 10:12:09.6406250 +05:30
(c) SYSUTCDATETIME() : Returns the current database system timestamp as a datetime2(7) value. The database time zone offset is not included.
Select SYSUTCDATETIME() –- Result 2008-02-10 04:44:52.1875000
(d) SWITCHOFFSET() : Returns a datetimeoffset value that is changed from the stored time zone offset to a specified new time zone offset.
SELECT SWITCHOFFSET ('2008-02-10 7:45:50.71345 -5:00', '-08:00') as SWITCHOFFSETResult
(e) TODATETIMEOFFSET () : Changes the time zone offset for a date and time value. This function can be used to update a datetimeoffset column.
SELECT TODATETIMEOFFSET ('2008-02-10 7:45:50.71345 -5:00', '-08:00') as TODATETIMEOFFSET
No comments:
Post a Comment