Re: how to cast this ?

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: juerg(dot)rietmann(at)pup(dot)ch
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to cast this ?
Date: 2002-09-12 09:45:54
Message-ID: 1031823954.18151.1.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 2002-09-12 at 10:22, juerg(dot)rietmann(at)pup(dot)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(dot)Elphick(at)lfix(dot)co(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message juerg.rietmann 2002-09-12 10:01:44 still sorting and casting problems
Previous Message juerg.rietmann 2002-09-12 09:22:35 how to cast this ?