Re: Insert into a date field

From: "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com>
To: "Shoaib Mir" <shoaibmir(at)gmail(dot)com>
Cc: "Richard Huxton" <dev(at)archonet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Insert into a date field
Date: 2007-02-02 13:49:41
Message-ID: 55c095e90702020549rc19501boa5d4ac4a18d9dc0c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Now it's ok thank you.

2007/2/2, Shoaib Mir <shoaibmir(at)gmail(dot)com>:
>
> Just tried the following way, that might help you:
>
> postgres=# create table testing (a date);
> CREATE TABLE
> postgres=# insert into testing values (to_date('1963-09-01',
> 'YYYY-MM-DD'));
> INSERT 0 1
> postgres=# select * from testing;
> a
> ------------
> 1963-09-01
> (1 row)
>
> --
> Shoaib Mir
> EnterpriseDB (www.enterprisedb.com)
>
> On 2/2/07, Richard Huxton <dev(at)archonet(dot)com> wrote:
>
> > Ezequias Rodrigues da Rocha wrote:
> > > Hi list,
> > >
> > > I am trying to insert a record in a table with a date field but the
> > > postgresql reports me the following error:
> > >
> > > ERROR: column "data_nascimento" is of type date but expression is of
> > type
> > > integer
> > > SQL state: 42804
> > > Hint: You will need to rewrite or cast the expression.
> > >
> > >
> > > I tryed like this:
> > >
> > >
> > > '1963-09-01'
> > > '1963-09-01'::date
> > > 1963-09-01
> >
> > Show us the whole statement - this doesn't look like the error to me.
> >
> > --
> > Richard Huxton
> > Archonet Ltd
> >
> > ---------------------------(end of broadcast)---------------------------
> >
> > TIP 4: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
>

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Atenciosamente (Sincerely)
Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda é melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mezei Zoltán 2007-02-02 13:54:24 Re: Duplicate records
Previous Message Ezequias Rodrigues da Rocha 2007-02-02 13:48:59 Duplicate records