Re: copy command - date

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: novice <user(dot)postgresql(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy command - date
Date: 2007-08-13 14:33:20
Message-ID: dcc563d10708130733n1d5272c9ua83daedd68760c90@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/12/07, novice <user(dot)postgresql(at)gmail(dot)com> wrote:
> I resolved it by doing this - is there another more efficient method?
> And yes, the text file I am working with doesn't have any TABs
>
> 5162 OK SM 06/12/04 06:12
>
> substr("data", 30, 2)||'-'||substr("data", 27,
> 2)||'-20'||substr("data", 24, 2)||substr("data", 32, 6) as
> inspection_date

I didn't have to do anything special, just copied it in:

create table g (ts timestamp);
set datestyle=ISO, MDY;
copy g (ts) from stdin;
06/12/04 12:00:00
\.
select * from g;
ts
---------------------
2004-06-12 12:00:00
delete from g;
set datestyle=ISO, DMY;
copy g (ts) from stdin;
06/12/04 12:00:00
\.
select * from g;
ts
---------------------
2004-12-06 12:00:00

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-08-13 14:35:13 Re: Persistent connections in PHP
Previous Message Coarr, Matt 2007-08-13 14:25:07 can i use an array as a table (in the from clause)