Alter Table Statement

The dBASE driver supports the Alter Table statement to add one or more columns to a table or to delete (drop) a single column.

The Alter Table statement has the form:

ALTER TABLE table_name {ADD column_name data_type | 
ADD(column_name data_type [, column_name data_type]... ) | 
DROP[COLUMN] column_name} 

table_name is the name of the table to which you are adding or dropping columns.

column_name assigns a name to the column you are adding or specifies the column you are dropping.

data_type specifies the native data type of each column you add.

For example, to add two columns to the emp table:

ALTER TABLE emp (ADD startdate date, dept char (10)) 

You cannot add columns and drop columns in a single statement, and you can drop only one column at a time. For example, to drop a column:

ALTER TABLE emp DROP startdate 

The Alter Table statement fails if you attempt to drop a column upon which other objects, such as indexes or views, are dependent.