Combining (concatenating) date and time into a datetime

后端 未结 12 968
夕颜
夕颜 2020-12-08 15:06

Using SQL Server 2008, this query works great:

select CAST(CollectionDate as DATE), CAST(CollectionTime as TIME)
from field

Gives me two co

12条回答
  •  清歌不尽
    2020-12-08 15:09

    The simple solution

    SELECT CAST(CollectionDate as DATETIME) + CAST(CollectionTime as DATETIME)
    FROM field
    

提交回复
热议问题