I have an issue to try to use a field defined as a decimal(17) in my table in a where condition to compare with string in a store procedure
table1.datedecimal decimal(17)
my sql query is
select field1, field2
from table1
where table1.datedecimal >= cast(cast('3-10-2011' as datetime) as decimal)
and table1.datedecimal <= cast(cast('24-10-2011' as datetime) as decimal)
but my query return 0 row
I’m appreciate if someone can help me please!!!
Thanks
This is really not enough information to find the problem.
'10-3-2011'as adecimalis40817.0.'10-24-2011'as adecimalis40838.0. Look through your table manually to see if any of the values fall between this.When you don’t get query results that you are expecting, you really need to analyze the data and the logic.
Another thing, this is one of those disadvantages from using the wrong datatypes to store certain data. I don’t see any benefit to store a
datetimeas adecimal.