Re: Copy table structure - Mailing list pgsql-novice

From paul@entropia.co.uk
Subject Re: Copy table structure
Date
Msg-id 3F83C15F.3147.3D13930@localhost
Whole thread Raw
In response to Copy table structure  (Anshuman Kanwar <ansh@expertcity.com>)
Responses Re: Copy table structure
List pgsql-novice
On 4 Oct 2003 at 12:22, Anshuman Kanwar wrote:

here's one way:

mfx=# begin; create table NEWTABLE as select * from OLDTABLE; delete from
NEWTABLE; end;

Hope this helps

Paul Butler

> Hi all,
>
> How do I copy only the table structure from one tabe to another.
>
> Table A has some data but I just want to copy the number of columns and the
> column names from this table  and create a table B. What is the best way of
> doing this ?
>
> Thanks in advance,
> -ansh
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org



pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: perlsub
Next
From: Peter Childs
Date:
Subject: Re: Copy table structure