Adding constraints  Dropping columns renumbers the column ID

Chapter 8: Creating Databases and Tables

Dropping columns

Drop a column from an existing table using:

alter table table_name
     drop column_name [, column_name]

Where:

You can drop any number of columns using a single alter table statement. However, you cannot drop the last remaining column from a table (for example, if you drop four columns from a five-column table, you cannot then drop the remaining column).

For example, to drop the advance and the contract columns from the titles table:

alter table titles
drop advance, contract

alter table rebuilds all indexes on the table when it drops a column.





Copyright © 2005. Sybase Inc. All rights reserved. Dropping columns renumbers the column ID

View this book as PDF