ODBC Server Reference Manual

Transact-SQL Language
HP NonStop ODBC Server Reference Manual429151-002
4-42
ALTER TABLE
None of the Transact-SQL DCL statements are supported.
ALTER TABLE
Use ALTER TABLE to add new columns to an existing table. The new column appears
as the last column of the table.
The ALTER TABLE statement has the following syntax:
table-name
is the table to alter. The table name can be qualified with the database name and
owner name. The fully expanded table name must be unique in the network.
column-name
is the column to add. The column name must be unique for columns defined in the
table.
If the statement contains errors, the results may be different than if executed using
SQL Server. See Adding Multiple Columns on page 4-43.
data-type
is the SQL Server data type for the column. Data types are converted to
NonStop SQL/MP data types. Data types are described under Language Elements
on page 4-5.
If you specify an unsupported data type, an error message is generated and the
statement is not executed.
NULL
is a required keyword that sets the initial values in the new column to NULL in
existing rows.
Examples
The following statement adds two columns to the DEPT table. The columns contain
BIT type data and are initialized as NULL:
use test_disk01_persnl
alter table dept
add deptnew int null,
deptclose int null
ALTER TABLE [ [database.]owner. ] table-name
ADD column-name data-type NULL
[ , column-name data-type NULL ] ...