Subject Re: [ib-support] how get the current year
Author Helen Borrie
At 12:34 PM 12-12-01 +0000, you wrote:
>hi to all
>I need get current year
>I do this:
>SELECT 'TODAY' FROM RDB$DATABASE INTO :MY_TODAY
>How can I use extract funtion to extract the year?
>I try
>SELECT EXTRACT(YEAR FROM 'TODAY') FROM RDB$DATABASE INTO :MY_YAR
>but i receive a error message "Specified EXTRACT part does not exist
>in input datatype"
>
>Are thre other way to do this?

Yes: in Dialect 3 you have to cast the date literals:

SELECT EXTRACT(YEAR FROM CAST('TODAY' AS DATE)) FROM RDB$DATABASE INTO :MY_YAR

cheers,
Helen