Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Aggiorna solo l'ora dal mio campo Datetime in sql

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

O questo

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