• INTERNATIONAL REVIEWS AND RATINGS FOR APP DEVELOPERS

CostmoSoft

  • home
  • time logger
  • forums
  • contact
Home › Forums › TimeLogger › General Discussion

Navigation

  • Recent posts

User login

  • Create new account
  • Request new password

Search

New forum topics

  • Discontiguous IDs
  • Jobs
  • guid table
  • Application icon and auto-start timers
  • Client info not available?
more

Importing into Postgres 1.0

kjtl — Fri, 02/05/2010 - 18:43

I wanted to import the csv file into a postgresql database.
I imagine this would be of use to others so ...

Here is the code I used.

-- DROP TABLE timelogger;

CREATE TABLE timelogger
(
started timestamp without time zone,
ended timestamp without time zone,
elapsedtime interval,
elapseddecimal double precision,
category character varying(250),
client character varying(250),
job character varying(250),
description text
)
WITHOUT OIDS;
ALTER TABLE timelogger OWNER TO postgres;

Then I imported into an open office spreadsheet.
In cell I2.

="insert into timelogger ( started, ended, elapsedtime, elapseddecimal, category, client, job, description) values ( '"&TEXT(A2;"yyyy-mm-dd hh:mm:ss")&"', '"&TEXT(B2;"yyyy-mm-dd hh:mm:ss")&"', '"&TEXT(C2;"hh:mm:ss")&"', "&D2&",'"&SUBSTITUTE(E2;"'";"''")&"', '"&SUBSTITUTE(F2;"'";"''")&"', '"&SUBSTITUTE(G2;"'";"''")&"', '" & SUBSTITUTE( H2; "'"; "''" ) & "') ;"

then fill down, then copy out the text and run against the timelogger database.

Regards

Keith Hutchison

order of Layout ›
  • General Discussion
  • Login or register to post comments
  • home
  • time logger
  • forums
  • contact