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 @ 2020-06-26 18:03  离。  阅读(118)  评论(0编辑  收藏