Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created October 3, 2017 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/089e4cfc47460272a3bd95c82150f3cc to your computer and use it in GitHub Desktop.
Save jpluimers/089e4cfc47460272a3bd95c82150f3cc to your computer and use it in GitHub Desktop.
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