Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C5B201337B82 for ; Tue, 8 Feb 2011 14:38:53 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 01073-07 for ; Tue, 8 Feb 2011 18:38:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from jupiter.marktest.pt (delta.marktest.pt [80.251.174.116]) by mail.postgresql.org (Postfix) with ESMTP id 304221337B92 for ; Tue, 8 Feb 2011 14:38:45 -0400 (AST) Received: from Proteu (proteu.marktest.pt [10.61.90.54]) by jupiter.marktest.pt with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id ZQ593W8V; Tue, 8 Feb 2011 18:38:44 -0000 Message-ID: <74DB3341AB704E989C87CAAD89D2526F@marktestcr.marktest.pt> From: "Oliveiros d'Azevedo Cristina" To: "Tarlika Elisabeth Schmitz" , References: <20110208181400.2e88d7cc@dick.coachhouse> Subject: Re: data import: 12-hour time w/o AM/PM Date: Tue, 8 Feb 2011 18:38:44 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.471 tagged_above=-5 required=5 tests=BAYES_00=-1.9, STOX_REPLY_TYPE=0.439, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/34 X-Sequence-Number: 35110 Howdy, Tarlika. If the data doesn't bring the AM/PM how are you supposed to distinguish between,say, 10pm and 10am ? Does it always start at 10:30am? So 10am never arises? Best, Oliveiros ----- Original Message ----- From: "Tarlika Elisabeth Schmitz" To: Sent: Tuesday, February 08, 2011 6:14 PM Subject: [SQL] data import: 12-hour time w/o AM/PM I am importing data in CSV format. My technique is to COPY the data into interim tables (starting with a "z") where I analyze them, clean up inconsistencies; eventually I will populate the "proper" tables with these data. (In the example below: COPY CSV into zevent, from there populate event.) The time field of the event data is givng me a headache: it's in 12h format but without the AM/PM qualifier! CREATE TABLE zevent ( id integer, previous integer, "next" integer, location_id integer NOT NULL, datum date NOT NULL, otime character varying(5) NOT NULL ) CREATE TABLE event ( id integer NOT NULL, location_fk integer NOT NULL, otime timestamp without time zone NOT NULL, next_fk integer, previous_fk integer, CONSTRAINT event_pkey PRIMARY KEY (id), CONSTRAINT next_event_fk FOREIGN KEY (next_fk) REFERENCES event (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT previous_event_fk FOREIGN KEY (previous_fk) REFERENCES event (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION )