alter table adds a column to the table with a column ID that is one greater than the current maximum column ID. For example, Table 8-5 lists the default column IDs of the salesdetail table:
Column name |
stor_id |
ord_num |
title_id |
qty |
discount |
---|---|---|---|---|---|
Col ID |
1 |
2 |
3 |
4 |
5 |
This command appends the store_name column to the end of the salesdetail table with a column ID of 6:
alter table salesdetail add store_name varchar(40) default "unknown" not null
If you add another column, it will have a column ID of 7.
Because a table’s column IDs change as columns are added and dropped, your applications should never rely on them.
Copyright © 2005. Sybase Inc. All rights reserved. |