Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id A81F3476126 for ; Wed, 13 Mar 2002 13:18:02 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 56B62D5F7; Wed, 13 Mar 2002 10:18:02 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 4C3E55BFD; Wed, 13 Mar 2002 10:18:02 -0800 (PST) Date: Wed, 13 Mar 2002 10:18:02 -0800 (PST) From: Stephan Szabo To: Cc: Subject: Re: Help reqd: Copying char to date In-Reply-To: Message-ID: <20020313101508.M84314-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200203/158 X-Sequence-Number: 7038 On Fri, 8 Mar 2002 rjb26@hotmail.losethis.nothere.com wrote: > On Fri, 08 Mar 2002 12:38:29 +0100, rjb26@hotmail.losethis.nothere.com > wrote: > > >Anybody offer some advice please: > > > >I want to copy a char field to a date field. Is there any quick way of > >doing this? > >TIA > > Sorry - this was not very clear. I can copy text to a date field; but > actually want to be able to perform the following: > > I have a text field (contents: 20020301) > I would like to change the field type to Date, but retain the > contents, but formatted as a date type. Any ideas, suggestions? Umm, if you don't have complicated foreign key structures and the like, you might just be able to do something like: select col1, col2, ... , coln::date, ... into tmp from starttable; alter table starttable rename to old; alter table tmp rename to starttable;