Unfortunately, there's no easy way to delete a column in a table in
PostgreSQL.
The standard SQL syntax is:
ALTER TABLE tablename DROP COLUMN columnname;
But I repeat, this is NOT supported in postgresql.
If you really need to delete a column you can always just create a new
table with an identical definition but WITHOUT the offending column, and
then
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;
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
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Suhadi
Sent: Monday, August 06, 2001 11:16 PM
To: SQL
Subject: [SQL] Delete coloumn
Please send to me how to delete coloumn in SQL.
Thank's
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]