Subject | Re: [ib-support] udf crashes firebird |
---|---|
Author | Ivan Prenosil |
Post date | 2003-05-19T17:14:27Z |
From: "Nick Upson" <uebridger@...>
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
> >2) There is EXTRACT built-in function (not in IB4, IB5 though),That's because 'today' is string - you can't subtract numbers from string.
> > 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
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