1. Determine whether the date is equal
Select * from Table where cast (convert(varchar(asdatetime)=' 2010-10-01'
Judgment logic: The Time field is now truncated by the CONVERT function, and then converted to datetime using the cast function.
2. Is the degree of interpretation equal to seconds?
Set @transfrom_date= CAST('1900-1-1'+ CONVERT(varchar( -),'Time Field',108) as datetime)Select * from Table where CAST('1900-1-1'+ CONVERT(varchar( -),'Time Field',108) as datetime)=@transfrom_date
Judgment logic: The time condition statement is now converted to degrees minutes and seconds, and then the query is executed and the time field of the comparison is converted to the same month or seconds of the day.
3. Determine whether the same year, month, day
Select * from Table --yearwhere DateDiff( Year,'Time Field','Time Conditions')=0--Monthwhere DateDiff(Month,'Time Field','Time Conditions')=0
--date where DateDiff (day,' time field ',' time Condition ')=0
SQL Judging time condition