sql 查询取当天的0点和当天的24点的数据

SELECT cast(convert(char(10),getdate(),120)+' 00:00:00' as datetime)--取0点
         
SELECT cast(convert(char(10),getdate(),120)+' 23:59:59' as datetime)--取24点
         

整合

SELECT * FROM MS_YJ01 where KDRQ between cast(convert(char(10),getdate(),120)+' 00:00:00' as datetime) and cast(convert(char(10),getdate(),120)+' 23:59:59' as datetime) ;
         

posted @ 2022-03-23 08:45  离。  阅读(736)  评论(0编辑  收藏  举报