Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 94213476B14 for ; Thu, 12 Sep 2002 05:45:54 -0400 (EDT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by postgresql.org (Postfix) with ESMTP id 09E79476B08 for ; Thu, 12 Sep 2002 05:45:54 -0400 (EDT) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 17pQXr-0005nm-0U; Thu, 12 Sep 2002 10:45:55 +0100 Received: from localhost ([127.0.0.1] helo=localhost.localdomain ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.36 #1 (Debian)) id 17pQXq-0004tM-00; Thu, 12 Sep 2002 10:45:54 +0100 Subject: Re: how to cast this ? From: Oliver Elphick To: juerg.rietmann@pup.ch Cc: pgsql-sql@postgresql.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 12 Sep 2002 10:45:54 +0100 Message-Id: <1031823954.18151.1.camel@linda> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/92 X-Sequence-Number: 9369 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