Created
October 3, 2017 08:19
-
-
Save jpluimers/089e4cfc47460272a3bd95c82150f3cc to your computer and use it in GitHub Desktop.
Firebird - generate time/date/timestamp values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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