Combining (concatenating) date and time into a datetime

后端 未结 12 951
夕颜
夕颜 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:21

    SELECT CONVERT(DATETIME, CONVERT(CHAR(8), date, 112) + ' ' + CONVERT(CHAR(8), time, 108))
      FROM tablename
    

提交回复
热议问题