ODBC Server Reference Manual

CORE SQL Language
HP NonStop ODBC Server Reference Manual429151-002
3-34
Example
data-type
the CORE SQL data type for the column. Data types are converted to NonStop
SQL/MP data types. Data types are described under Language Elements on
page 3-2.
Example
The following statement adds two columns to the DEPT table. The columns contain
BIT type data and are initialized as NULL:
alter table dept
(add deptnew int,
deptclose int)
Adding Multiple Columns
Because NonStop SQL/MP does not allow you to add multiple columns with one
statement, the NonStop ODBC Server translates an ALTER TABLE statement with
multiple column specifications to multiple NonStop SQL/MP ALTER TABLE statements.
If one of those statements contains an error, depending on where the error occurs,
other statements can be executed and the specified columns will be added. However, if
a multiple-column ALTER TABLE statement is bound by a user transaction, and an
error occurs, no columns are added.
CORE SQL Compared With NonStop SQL/MP
The corresponding NonStop SQL/MP statement is ALTER TABLE ADD COLUMN.
ALTER TABLE in CORE SQL differs from the NonStop SQL/MP implementation in the
following ways:
Feature In NonStop SQL/MP In CORE SQL
Number of columns you can
add with ALTER TABLE
One Multiple
Can you specify default
values?
Yes No. You cannot specify a
default value unless you use
pass-through mode.
Is NOT NULL available? Yes No. New columns always allow
null values. You cannot specify
the NOT NULL attribute unless
you use pass-through mode.
Can you alter attributes of a
table or column using ALTER
TABLE?
Yes No. You cannot alter the
attributes of a column unless
you use pass-through mode.