当前位置: 代码迷 >> Sql Server >> The conversion of a char data type to a datetime data type resulted in an out-of-range datetime valu解决办法
  详细解决方案

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime valu解决办法

热度:588   发布时间:2016-04-27 11:10:36.0
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime valu
时间的格式不正确。
YY-MM-DD
SQL code
select HelpDateTime  from Shop_Help where  HelpDateTime < '2009-06-22' 

假如写成'2009-06-22' 就会提示The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.的错误
而要是'2009-06-12' 就没事。也就是说DAY这。要是少于13就OK。它默认的是十二月份(1-12)只要出现13天了错误就出现了!!!


怎么解决呀!!

------解决方案--------------------

SQL code
select HelpDateTime  into # from Shop_Help where  isDate(HelpDateTime )=1select * from # where HelpDateTime < '2009-06-22'
------解决方案--------------------
HelpDateTime 的问题。
  相关解决方案