根据用户输入的时间查询那天的数据

根据用户输入的时间查询那天的数据

即 >=用户输入的时间  <用户输入+1天的时间

select * from Pt_MZ_ChargeDetail  where 1=1  and PriceDate >='2013-08-20' AND PriceDate<DATEADD(d,1,CONVERT(varchar(100), '2013-08-20', 20))

这种方式为什么查不到结果

select * from Pt_MZ_ChargeDetail  where 1=1  and PriceDate like '%2013-08-20%' 

如果只用2013就可以查到的

select * from Pt_MZ_ChargeDetail  where 1=1  and PriceDate like '%2013%' 
原文地址:https://www.cnblogs.com/0banana0/p/3240284.html