pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to cast this ?
2+ messages / 2 participants
[nested] [flat]

* how to cast this ?
@ 2002-09-12 09:22  juerg.rietmann@pup.ch
  0 siblings, 1 reply; 2+ messages in thread

From: juerg.rietmann@pup.ch @ 2002-09-12 09:22 UTC (permalink / raw)
  To: pgsql-sql

Hello there

I have a db table with two char fields :

log_date char(10)
log_time char(8)

I added a new field log_timestamp of type timestamptz

How do I take the data from log_date and log_time and put it into
log_timestamp ?

update log set log_timestamp = cast (log_date as timestamp) || cast
(log_time as timestamp)

is not working.

Thank's in  advance ... jr

__________________________________________________

PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland

internet          :  www.pup.ch
phone       : +4141 790 4040
fax         : +4141 790 2545
mobile            : +4179 211 0315
__________________________________________________





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

* Re: how to cast this ?
@ 2002-09-12 09:45  Oliver Elphick <olly@lfix.co.uk>
  parent: juerg.rietmann@pup.ch
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Elphick @ 2002-09-12 09:45 UTC (permalink / raw)
  To: juerg.rietmann@pup.ch; +Cc: pgsql-sql

On Thu, 2002-09-12 at 10:22, juerg.rietmann@pup.ch wrote:
> Hello there
> 
> I have a db table with two char fields :
> 
> log_date char(10)
> log_time char(8)
> 
> I added a new field log_timestamp of type timestamptz
> 
> How do I take the data from log_date and log_time and put it into
> log_timestamp ?
> 
> update log set log_timestamp = cast (log_date as timestamp) || cast
> (log_time as timestamp)
> 
> is not working.

I don't know what format you have your dates and times in, but maybe
this will work:

  CAST (log_date || ' ' || log_time) AS TIMESTAMP

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                            
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Let the wicked forsake his way, and the unrighteous 
      man his thoughts; and let him return unto the LORD, 
      and He will have mercy upon him; and to our God, for 
      he will abundantly pardon."          Isaiah 55:7 




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


end of thread, other threads:[~2002-09-12 09:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12 09:22 how to cast this ? juerg.rietmann@pup.ch
2002-09-12 09:45 ` Oliver Elphick <olly@lfix.co.uk>

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