1

当我执行时:   

SELECT some_fields 
FROM some_table  
WHERE some_other_field BETWEEN '20130901' AND '20131131'

在将 VARCHAR 值“20131131”隐式转换为 SMALLDATETIME 字段期间出现错误 (247) 算术溢出。** 

但是当我执行时:

SELECT some_field  
FROM some_table 
WHERE some_other_field BETWEEN  '20130901' AND '20131130'

没有抱怨。(Sybase 15.7.0)

4

1 回答 1

1

11 月只有 30 天,20131131 无法转换为日期,因为它不存在。将第一个语句中的 where 子句从

WHERE some_other_field BETWEEN '20130901' AND '20131131'

对此

WHERE some_other_field BETWEEN '20130901' AND '20131130'

它应该执行没有问题。

于 2013-11-14T15:01:19.073 回答