1:
where dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'
2:
where dateadd(year,35,cast(日期+'01' as datetime)) <= '2004-09-01'
where dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'
2:
where dateadd(year,35,cast(日期+'01' as datetime)) <= '2004-09-01'
但是还是出现了
CHAR数据类型到datatime数据类型值的转换导致datatime值越界的问题
8位时:
Select * from 表 where isdate(日期) = 0
6位时:
Select * from 表 where isdate(日期+'01') = 0
Select isdate('19990230')
返回 0
Select isdate('19990220')
返回 1
当我限制了非法的日期后再用你的办法来计算时还是有从字符串转化为DATETIME型时语法有错误呀?
try:
Select * from
(Select * from 表 where isdate(日期) = 1) aa
where dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'
Select * from 表 where isdate(日期) = 1 and
dateadd(year,35,cast(日期 as datetime)) <= '2004-09-15'