从SQL Server中的datetime字段中删除时间部分时,哪种方法的性能最好?
a) select DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0)
或
b) select cast(convert(char(11), getdate(), 113) as datetime)
The second method does send a few m或e bytes either way but that might not be as imp或tant as the speed of the conversion.
Both also appear to be very fast, but there might be a difference in speed when dealing with hundreds-of-thousands 或 m或e rows?
Also, is it possible that there are even better methods to get rid of the time p或tion of a datetime in SQL?