CREATE TABLE statement
470
When using this default, the value of the public option
Global_database_id in each database must be set to a unique,
positive integer. This value uniquely identifies the database and
indicates from which partition default values are to be assigned. The
range of allowed values is n p + 1 to (n + 1) p, where n is the value
of the public option Global_database_id and p is the partition size.
For example, if the partition size is 1000 and Global_database_id
is set to 3, then the range is from 3001 to 4000.
If the previous value is less than (n + 1) p, the next default value
will be one greater than the previous largest value in column. If the
column contains no values, the first default value is n p + 1.
If the public option Global_database_id is set to zero, a null value
is inserted into the column. Should null values not be permitted, the
attempt to insert the row causes an error. This situation arises, for
example, if the column is contained in the table’s primary key. The
public option Global_database_id is set to zero by default.
Null default values are also generated when the supply of values
within the partition has been exhausted. In this case, a new value of
Global_database_id should be assigned to the database to allow
default values to be chosen from another partition. Attempting to
insert the null value causes an error if the column does not permit
nulls. To detect that the supply of unused values is low and handle
this condition, create an event of type GlobalAutoincrement.
You cannot use DEFAULT GLOBAL AUTOINCREMENT on
databases created with version 6 or earlier software, even if they
have been upgraded.
♦
Constant expressions Constant expressions that do not reference
database objects are allowed in a DEFAULT clause, so functions
such as GETDATE or DATEADD can be used. If the expression is
not a function or simple value, it must be enclosed in parentheses.
♦
TIMESTAMP Provides a way of indicating when each row in the
table was last modified. When a column is declared with
DEFAULT TIMESTAMP, a default value is provided for inserts,
and the value is updated with the current date and time whenever
the row is updated.
To provide a default value on insert, but not update the column
whenever the row is updated, use DEFAULT CURRENT
TIMESTAMP instead of DEFAULT TIMESTAMP.
$ For more information on timestamp columns, see "The special
Transact-SQL timestamp column and data type" on page 972 of the
book ASA User’s Guide.