Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Firebird - generate time/date/timestamp values
with
recursive
sequence(n) as (
-- When you select more than 1024 values, this error occurs:
-- Error while fetching data: Too many concurrent executions of the same request
select 0 -- start
from rdb$database
union all
select sequence.n + 1
from sequence
where sequence.n < 1023 -- finish
)
select sequence.n
, sequence.n * 59 + time '00:00:00' as nTime -- 59 is prime, so we get seconds, minutes and hours
, sequence.n * 13 + date '1899-12-30' as nDate
, sequence.n * 13.059 + timestamp '1899-12-30 00:00:00.000' as nTimeStamp
from sequence
order by sequence.n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.