如何将yyyy-mm-dd hh:nn:ss的DateTime字段更新为yyyy-mm-dd 00:00:00?
我的意思是假设字段值为2004-08-22 14:30:21,如何把时分秒归零?我现在的做法很笨:
update tablea
set datefld = cast(cast(year(datefld) as varchar(4))
+'-'+cast(month(datefld) as varchar(2))
+'-'+cast(day(datefld) as varchar(2)) as DateTime)
有没有好一点的方法或者现成的SQL函数?