Subject Re: [ib-support] Date in SQL
Author Steve Summers
""Andrew Neillans"" <andy@...> wrote in message
news:babb03+sc7l@......
> Hi,
> ...
> Is it possible to do a date search on a varchar, or am I going to
> have to try and find the original source of the application that runs
> this database and change it? (Please dont say this .... :p).

Don't panic- See the Interbase 6.0 language reference (IB6LangRef.pdf,
downloadable from IBPhoenix.com). Under the topic fro Cast() it says:

Example In the following WHERE clause, CAST() is used to translate a
CHARACTER datatype, INTERVIEW_DATE, to a DATE datatype to compare against a
DATE datatype, HIRE_DATE:
. . .
WHERE HIRE_DATE = CAST (INTERVIEW_DATE AS DATE);
To cast a VARCHAR datatype, you must specify the length of the string, for
example:

UPDATE client SET charef = CAST (clientref AS VARCHAR(20));

Hope that helps.