Join Date and Time with SQL server

0

Hi, I'm working with SQL 14, and I want to join two columns one is Date and the Other Time, I've tried several ways but none of them I'm concerned, I mean they work or join the columns but when I do a query I do not know The change is reflected.

SELECT Planta, Fecha FROM (
SELECT Planta, CAST(CONVERT(varchar(10), Fecha) +' '+ CONVERT(varchar(11), 
Hora) AS datetime) AS Fecha

FROM dbo.tblHideUtilizationJDE
WHERE Fecha BETWEEN '2017-07-23 06:00:00.000' AND '2017-07-26 05:59:59.000'
GROUP BY Planta,  Fecha
    
asked by Samano Cedillo 20.08.2017 в 06:55
source

1 answer

0

It's simple, use the following sentence:

SELECT Planta, Fecha = CONVERT(DATETIME, Fecha) + CONVERT(DATETIME, Hora)
  FROM dbo.tblHideUtilizationJDE
 WHERE Fecha BETWEEN '2017-07-23 06:00:00.000' AND '2017-07-26 05:59:59.000'
    
answered by 21.08.2017 / 22:39
source