Comparing Date with Decimal Column

Not applicable

Comparing Date with Decimal Column

I have a scenario where I need to figure out if the given data falls between the two dates.These two dates are two columns in which are datatype as Decimal(6,0).So my query according to requirement is something like this:

SELECT * from abc where columna='abc' AND '04/06/06'(date,format 'mm/dd/yy') Between col1 And col2.

Note: '04/06/06'(date,format 'mm/dd/yy') is the variable being passed.
Col1 and col2: These are columns which are of decimal type(6,0) but they have dates as values.

Thanks for reading and if possible, please suggest me something.

Re: Comparing Date with Decimal Column

Try this.

sel * from tablename
where columna = 'bcd'
and '03/01/06' between cast(col1 as date format 'mm/dd/yy') and cast(col2 as date format 'mm/dd/yy') ;