Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Atualizar apenas a hora do meu campo Datetime no sql

UPDATE MyTable 
SET MyDate = DATEADD(HOUR, 4, CAST(CAST(MyDate AS DATE) AS DATETIME)) 

Ou isto
UPDATE MyTable 
SET MyDate = DATEADD(HOUR, 4, CAST(FLOOR(CAST(MyDate AS FLOAT)) AS DATETIME))