pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Insert into a date field
5+ messages / 4 participants
[nested] [flat]

* Insert into a date field
@ 2007-02-02 13:08  Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Ezequias Rodrigues da Rocha @ 2007-02-02 13:08 UTC (permalink / raw)
  To: pgsql-sql

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

And notthing

Thanks in advance.
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                  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/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Insert into a date field
@ 2007-02-02 13:12  Richard Huxton <dev@archonet.com>
  parent: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Richard Huxton @ 2007-02-02 13:12 UTC (permalink / raw)
  To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Insert into a date field
@ 2007-02-02 13:45  Shoaib Mir <shoaibmir@gmail.com>
  parent: Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Shoaib Mir @ 2007-02-02 13:45 UTC (permalink / raw)
  To: Richard Huxton <dev@archonet.com>; +Cc: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>; pgsql-sql

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@archonet.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
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Insert into a date field
@ 2007-02-02 13:49  Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
  parent: Shoaib Mir <shoaibmir@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Ezequias Rodrigues da Rocha @ 2007-02-02 13:49 UTC (permalink / raw)
  To: Shoaib Mir <shoaibmir@gmail.com>; +Cc: Richard Huxton <dev@archonet.com>; pgsql-sql

Now it's ok thank you.

2007/2/2, Shoaib Mir <shoaibmir@gmail.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@archonet.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/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Insert into a date field
@ 2007-02-02 14:56  Hiltibidal, Robert <Robert.Hiltibidal@argushealth.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Hiltibidal, Robert @ 2007-02-02 14:56 UTC (permalink / raw)
  To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>; pgsql-sql

Try this:

'1/9/1963'

 

I'm interpreting your date to be January 9, 1963. 

 

-R

 

________________________________

From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Ezequias Rodrigues da Rocha
Sent: Friday, February 02, 2007 7:08 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Insert into a date field

 

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

And notthing

Thanks in advance.
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                                  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/ 


PRIVILEGED AND CONFIDENTIAL
This email transmission contains privileged and confidential information intended only for the use of the individual or entity named above.  If the reader of the email is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any use, dissemination or copying of this email transmission is strictly prohibited by the sender.  If you have received this transmission in error, please delete the email and immediately notify the sender via the email return address or mailto:postmaster@argushealth.com.  Thank you.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2007-02-02 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-02 13:08 Insert into a date field Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
2007-02-02 13:12 ` Richard Huxton <dev@archonet.com>
2007-02-02 13:45   ` Shoaib Mir <shoaibmir@gmail.com>
2007-02-02 13:49     ` Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
2007-02-02 14:56 Re: Insert into a date field Hiltibidal, Robert <Robert.Hiltibidal@argushealth.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox