The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Firebird – generate time/date/timestamp values

Posted by jpluimers on 2017/10/31

I needed the script in [WayBackFirebird – generate time/date/timestamp values to reproduce a problem in Database Workbench <= 5.3.2 with exporting TIME and TIMESTAMP values to Excel xlsx format: the time portion got lost so

The bug is fixed so will appear in the next beta and release versions: [WayBack] 0001506: Timestamp export to Excel XLSX only shows date, Time fails, CSV shows both date and time – Bug & Feature Tracker @ Upscene.com

–jeroen


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

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.