从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界

 select e_salecode as salecode ,count(e_quantity)as quantity from e_stockout
  where datediff(d,e_entertime,getdate())=0 and e_stockid =3 group by e_salecode

执行后说从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界

select e_salecode as salecode ,count(e_quantity)as quantity from e_stockout
  where datediff(d,convert(varchar(10),e_entertime,20) ,getdate())=0 and e_stockid =3 group by e_salecode

执行通过

posted @ 2012-01-11 17:27  放哨De老鼠  阅读(953)  评论(0编辑  收藏  举报