SQL Server数据库中时间比较,这样比较准确

SQL数据库中对于时间的精确度比较做的不是很好。有时候是把值当成字符串的方式处理。
所以要比较两个日期还是这样比较好:

AND  year(AttendanceDate)=year(C_Date)
AND month(AttendanceDate)=month(C_Date)
AND day(AttendanceDate)=day(C_Date)

猜你喜欢

转载自renzp27.iteye.com/blog/2177374