Re: select into without creating new table

From: "Patrick Fiche" <patrick(dot)fiche(at)aqsacom(dot)com>
To: "'Paul'" <nomail(at)nomail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: select into without creating new table
Date: 2002-10-21 13:53:50
Message-ID: 85058ADF852DD5118FD50002A528A5B6079A97@SERVEUR
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


INSERT INTO newtable ( col1, col2 ) SELECT cola, colb FROM oldtable

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Paul
Sent: Friday, October 18, 2002 1:45 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] select into without creating new table

Hi,

How can I select data from table into an existing table. I've redesigned
some tables and thus want my data to be copied from the old table to the new
one. Since the column order, names (and the number of columns) is not equal
i thought of using:

select column1,column2 into newtable from oldtable

THis however leads to an error that states that the table exists already.
Deleting the table is no option for me since I want the data to be in the
table with the new structure.

Any help would be appreciated!

-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers
=-----

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

Browse pgsql-general by date

  From Date Subject
Next Message Erwan DUROSELLE 2002-10-21 13:56:07 Rép. : pgAdmin II connection problem
Previous Message Shridhar Daithankar 2002-10-21 13:52:47 Re: transactions