1

When I execute:   

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

I get Error (247) Arithmetic overflow during implicit conversion of VARCHAR value '20131131' to SMALLDATETIME field.** 

But when I execute:

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

no complains.  (Sybase 15.7.0)

Cœur
  • 37,241
  • 25
  • 195
  • 267
code4jhon
  • 5,725
  • 9
  • 40
  • 60

1 Answers1

1

November only has 30 days, 20131131 can't be converted to a date because it doesn't exist. Change the where clause in your first statement from

WHERE some_other_field BETWEEN '20130901' AND '20131131'

to this

WHERE some_other_field BETWEEN '20130901' AND '20131130'

It should execute no problem.

ovaltein
  • 1,185
  • 2
  • 12
  • 34