1:
   where dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'
2:
   where dateadd(year,35,cast(日期+'01' as datetime)) <= '2004-09-01'

解决方案 »

  1.   

    谢谢   txlicenhe(马可) 
    但是还是出现了
    CHAR数据类型到datatime数据类型值的转换导致datatime值越界的问题
      

  2.   

    那是你的资料不规范用如下语句查一下:
    8位时:
    Select * from 表 where isdate(日期) = 0
    6位时:
    Select * from 表 where isdate(日期+'01') = 0
      

  3.   

    eg: 
    Select isdate('19990230')  
        返回  0
    Select isdate('19990220')  
        返回  1
      

  4.   

    txlicenhe(马可):
    当我限制了非法的日期后再用你的办法来计算时还是有从字符串转化为DATETIME型时语法有错误呀?
      

  5.   

    楼主是怎样限制这些非法日期的?
    try:
     Select * from 
    (Select * from 表 where isdate(日期) = 1) aa
    where dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'
      

  6.   

    如下方式是不能限制非法日期的。
    Select * from 表 where isdate(日期) = 1 and 
      dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'