The TIME data type in SQL Server 2008

Similarly to my previous post, another new data type in SQL Server 2008 is the "TIME".

Again, without having to manipulate the current datetime for getting the time, you just have to cast it to the TIME data type. Here's the syntax:

select cast(SYSDATETIME() as TIME) as [current_time]

--or

select cast(getdate() as TIME) as [current_time]

Labels: , ,