ALTER TABLE DROP COLUMN

Drops a column from a table.

SYNTAX

table_name Name of the table you are dropping the column from.
column_name Name of the column you are dropping.

DESCRIPTION

The ALTER TABLE DROP COLUMN command modifies the definition of an existing table and drops a column that was previously defined. To execute the ALTER TABLE DROP COLUMN command on a table, you must be the table owner, have DBA or SYSADM security privileges, or have the ALTER privilege for that table.

You can use this command to drop a column from a table when it is no longer necessary. You cannot drop a column if a primary or foreign key has been defined on that column, unless you drop the primary or foreign key first. You can drop a column if a view has been defined on that column, but the view will be invalid and DBMaker will return an error when you try to use the view. This command should be used with caution since the data in a column cannot be recovered once you drop the column.

EXAMPLE

The following command drops the BirthDate column from the Employees table.

ALTER TABLE Employees DROP (BirthDate)

The following command drops the BirthDate and HireDate columns from the Employees table.

ALTER TABLE Employees DROP (BirthDate, HireDate)

RELATED COMMANDS

< ALTER TABLE ADD COLUMN | Contents | ALTER TABLE DROP FOREIGN KEY >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.