【发布时间】:2019-08-26 06:23:08
【问题描述】:
我有一个表,其中一列作为registrationDate,其类型是日期时间。我需要找到所有registrationDate作为时间戳为00:00:00.000的行。 例如:
registrationDate: '2019-03-20 00:00:00.000'
我需要查询类似如下的内容:
select * from table where registrationDate like '%00:00:00.000';
【问题讨论】:
-
请不要将日期时间值视为字符串。它们不是字符串,
LIKE将不起作用(我相信您已经尝试过)。您要查找的是具有午夜时间分量的数据。 -
(我在this post谈过这个。)
标签: sql sql-server tsql date datetime