RE: Delete coloumn

From: "Grigoriy G(dot) Vovk" <grigoriy(dot)vovk(at)linustech(dot)com(dot)cy>
To: Robby Slaughter <webmaster(at)robbyslaughter(dot)com>
Cc: Suhadi <suhadi(at)indosatcom(dot)net>, SQL <pgsql-sql(at)postgresql(dot)org>
Subject: RE: Delete coloumn
Date: 2001-08-07 08:13:55
Message-ID: 20010807110112.R931-100000@callisto.internal.linustech.com.cy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Aug 6, 23:35 -0500, Robby Slaughter wrote:

> SELECT INTO it. Example:
>
> CREATE TABLE sample (
> id INTEGER,
> data TEXT,
> badcolumn DATE );
>
> Now to delete the bad column table:
>
> CREATE TABLE sample_copy (
> id INTEGER,
> data TEXT);
>
> and then copy it all over:
>
> SELECT id,data INTO sample_copy FROM sample;

It is not correct. This statement used to _create_ _new_ table.
Correct is:
insert into sample_copy select id, data from sample;

>
> and then you can DROP TABLE sample;
>
> If you need the original table name, repeat the process of
> creating a new table now and copying the data over.
>
> Hope that helps!
>
> -Robby Slaughter

my best regards,
----------------
Grigoriy G. Vovk

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Denis Bucher 2001-08-07 09:54:52 Are circular REFERENCES possible ?
Previous Message Stephan Szabo 2001-08-07 05:42:03 Re: Delete Trigger Issue