Re: datestyle question

Поиск
Список
Период
Сортировка
От Diego Gil
Тема Re: datestyle question
Дата
Msg-id 1190848135.3098.21.camel@roadwarrior.maipucinos.com.ar
обсуждение исходный текст
Ответ на Re: datestyle question  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список pgsql-general
El mié, 26-09-2007 a las 17:24 -0500, Scott Marlowe escribió:
> On 9/26/07, Diego Gil <diego@adminsa.com> wrote:
> > Hi,
> >
> > I have a file to import to postgresql that have an unusual date format.
> > For example, Jan 20 2007 is 20022007, in DDMMYYYY format, without any
> > separator. I know that a 20072002 (YYYYMMDD) is ok, but I don't know how
> > to handle the DDMMYYYY dates.
> >
> > I tried and tried but I can't import those dates to postgresql.
> >
> > Any hint, other than editing file ?
>
> There are two approaches.  One is to use something like sed or awk or
> perl or php to read the file and rearrange those bits to a format that
> makes sense to pgsql, or you can import that field into a text field,
> and use something like substring() in postgresql to update a new field
> that holds dates with the right numbers.

That is what I did on a previous file, sometime ago. Having now several
date fields, I was trying to simplify the task, is possible. But it
seems I will have no luck !.

I will explore a little what Erik Jones suggested: inserting dashes with
awk.

Thanks,
Diego.


В списке pgsql-general по дате отправления:

Предыдущее
От: Diego Gil
Дата:
Сообщение: Re: datestyle question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PQntuples return type