Search   Feed   Browse   Add
Feed items 1 - 1 of 1 for October 2007

Populating a PostgreSQL Calendar Table - October 28, 2007

I'm using PostgreSQL for my data warehouse. I needed a calendar table for doing joins and a quick way to populate it. So I created my calendar table with: CREATE TABLE "CALENDAR" ( "YYYYMMDD" date NOT NULL ); Then I populated it with the following SQL: INSERT INTO "CALENDAR" ("YYYYMMDD") select to_date('20000101', 'YYYYMMDD') + s.a as dates from generate_series(0,36524,1) as s(a); This quickly puts records into the CALENDAR table for every day starting with 112000 and ending with 12312099.
http://www.geekwisdom.com/dyn/node/195
Available Archives
- March (1 item)
- May (1 item)
- June (2 items)
- October (1 item)
- November (1 item)
- December (1 item)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact