How to convert dates in varchar to date in SQL 'Firebird'?

0

How can I convert dates to varchar for date ? I'm having difficulty performing cross-date searches because of this discrepancy in the database where I query.

When I enter my line of code:

select *
from TAB_FATURAMENTO
where cd_cliente like '%'
and dt_item between '15/05/2017' and '31/05/2017';

The result of my search returns me values from dates before my range. The dt_item column is in varchar (10) and stores the value in dd/mm/yyyy format.

When I try to use CAST , I get the following error:     ISC ERROR CODE: 335544334

ISC ERROR MESSAGE:
conversion error from string "22/07/2008"

STATEMENT:
TIBOInternalDataset: "<TApplication>.frmMain.dlgWisql.<TIBOQuery>.<TIBOInternalDataset>."


Statement: select *
from TAB_FATURAMENTO
where cd_cliente like '%'
and CAST(TAB_FATURAMENTO.dt_item as DATE) between '15/05/2017' and '31/05/2017';
    
asked by anonymous 02.06.2017 / 14:14

1 answer

0

Put it like this select * from TAB_FATURAMENTO where cd_cliente like '%' and dt_item between **"15/05/2017"** and **"31/05/2017"**

With Double Quotes I'll do it like this.

    
11.07.2017 / 21:14