Compare time part of DateTime data type in SQL Server 2005

前端 未结 6 1869
梦谈多话
梦谈多话 2021-01-02 07:41

How can I compare only the time portion of a DateTime data type in SQL Server 2005? For example, I want to get all records in which MyDateField is after a specific time. The

6条回答
  •  失恋的感觉
    2021-01-02 07:59

    SELECT *
    FROM Table1
    WHERE DATEADD(day, -DATEDIFF(day, 0, MyDateField), MyDateField) > '12:30:50.400'
    

提交回复
热议问题