If a table contains data, when you add a column with a NOT NULL constraint you must also include a DEFAULT clause. If the table is empty, however, you can add a column and apply only the NOT NULL constraint. The following statement is valid whether or not the table contains data:
ALTER TABLE items ADD (item_weight DECIMAL(6,2) DEFAULT 2.0 NOT NULL BEFORE total_price)Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]