sql server中日期查询

convert(varchar,create_date,121)这样就能查询出来的数据就是2017-04-17 09:35:10:480,


select * from ApplyInfo join Users on ApplyInfo.ApplyMan=Users.UserId where 

convert(varchar(10),ApplyDate,120)='2008-03-14'--sql server中查询与日期相等的方法。

select * from ApplyInfo join Users on ApplyInfo.ApplyMan=Users.UserId

 where convert(varchar(10),ApplyDate,120) between '2008-03-14' and '2008-03-17' --sql server中查询2个日期之间的记录。

  1. select tname 今天的值方式二 from tt Where tdate >= convert(char(10),getdate(),120) and tdate<convert(char(10),getdate()+1,120)  

猜你喜欢

转载自blog.csdn.net/zhanganggang/article/details/80847106