pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: juerg.rietmann@pup.ch
Cc: pgsql-sql@postgresql.org
Subject: Re: how to cast this ?
Date: 12 Sep 2002 10:45:54 +0100
Message-ID: <1031823954.18151.1.camel@linda> (raw)
In-Reply-To: <OF44E0446D.F551C2BF-ONC1256C32.00331D16-C1256C32.003397BB@pup.ch>
References: <OF44E0446D.F551C2BF-ONC1256C32.00331D16-C1256C32.003397BB@pup.ch>

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 




view thread (2+ messages)

Message-ID: <1031823954.18151.1.camel@linda>
Permalink:  ../1031823954.18151.1.camel@linda/
Also on:    postgresql.org/message-id/1031823954.18151.1.camel@linda

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: olly@lfix.co.uk, juerg.rietmann@pup.ch
  Subject: Re: how to cast this ?
  In-Reply-To: <1031823954.18151.1.camel@linda>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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