Progress
SQL-89
Guide and Reference


ALTER TABLE Statement

Adds new columns to a table, deletes columns from a table, or changes the format or labels associated with an existing column.

SYNTAX
ALTER TABLE table-name
  {
    {  ADD COLUMN column-name data-type
             [ FORMAT string ]
             [ LABEL string ]
             [ COLUMN-LABEL string ]
             [ DEFAULT initial-value ]
             [ [ NOT ] CASE-SENSITIVE ]
     }
       |  { DROP COLUMN column-name }
       |  { ALTER COLUMN column-name 
             [ FORMAT string ]
             [ LABEL string ]
             [ COLUMN-LABEL string ]
             [ DEFAULT initial-value ]
             [ [ NOT ] CASE-SENSITIVE ]
           }
  } 

table-name

Represents the name of the table you want to change.

ADD COLUMN column-name data-type

Adds a new column to the specified table. You must specify the data type of the new column you want to add. The Progress/SQL data types are CHARACTER, INTEGER, SMALLINT, DECIMAL, FLOAT, DATE, REAL, NUMERIC, and LOGICAL.

FORMAT string

Specifies the display format for the column. You must enclose the string in single or double quotation marks. The data type determines the storage format of the column.

LABEL string

Specifies a label for the column. You must enclose the string in single or double quotation marks.

COLUMN-LABEL string

Specifies a label for the column when its values are displayed vertically (in columns) on the screen or in a printed report. You must enclose the string in single or double quotation marks.

DEFAULT initial-value

Assigns a default value for the column. This is the same as setting the default value for a field in the Progress Data Dictionary.

[ NOT ] CASE-SENSITIVE

Indicates whether the values in a character column and the comparisons made to it must be case sensitive. The default is case sensitive if you used the ANSI SQL (-Q) parameter. Otherwise, the default is not case sensitive. You cannot specify the [NOT] CASE-SENSITIVE option on ALTER COLUMN if the column being altered already participates in any indexes.

DROP COLUMN column-name

Deletes the specified column from the table.

ALTER COLUMN column-name

Changes the display format, label, default value, or column label for the specified column. (You can also change all four items for the specified column with ALTER COLUMN.)

EXAMPLES

The following examples show how you can add or change a column for the cust_table table.

ALTER TABLE Cust_Table                   
  ADD COLUMN Contact CHARACTER (30). 

ALTER TABLE Cust_table            
  DROP COLUMN Sales_Rep. 

ALTER TABLE Cust_Table
  ALTER COLUMN Contact
    LABEL ’Customer Contact’. 

NOTES

SEE ALSO

CREATE SCHEMA Statement (ESQL Only), CREATE TABLE Statement, DROP TABLE Statement, GRANT Statement, REVOKE Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095