Subject Re: [ib-support] udf crashes firebird
Author Ivan Prenosil
From: "Nick Upson" <uebridger@...>
> >2) There is EXTRACT built-in function (not in IB4, IB5 though),
> > to return Monday = 1, .. Sun = 7, use it that way
> > EXTRACT(WEEKDAY FROM my_date_field - 1) + 1
>
> using FB1.0.2 but I can't get EXTRACT(WEEKDAY FROM 'today'- 1) + 1 to work

That's because 'today' is string - you can't subtract numbers from string.
Either cast it to date (or timestamp, so it can work with dialect-1 too):

EXTRACT(WEEKDAY FROM CAST('today' AS TIMESTAMP) - 1) + 1

or better yet use CURRENT_DATE or CURRENT_TIMESTAMP instead:

EXTRACT(WEEKDAY FROM CURRENT_TIMESTAMP - 1) + 1


Ivan Prenosil
[ I am looking for a job: InterBase - Firebird - Delphi - C - fulltext db - and more ... ]
Ivan.Prenosil@...
http://www.volny.cz/iprenosil/interbase