Column defaults automatically assign a specified value to a particular column or set of columns whenever someone enters a new row into a database table. The default value assigned requires no action on the part of the client application. However, if the client application does specify a value for the column, the new value overrides the column default value.
Column defaults can quickly and automatically fill columns with information, such as the date or time a row is inserted or the user ID of the person who first modified a row in a table. Using column defaults encourages data integrity, but does not enforce it. Client applications can always override defaults.
Sybase IQ supports the following default values for columns:
A string specified in the CREATE TABLE statement or ALTER TABLE statement
A number specified in the CREATE TABLE statement or ALTER TABLE statement
An automatically incremented number: one more than the previous highest value in the column
UUID (Universally Unique IDentifier) values generated by the NEWID function
The current date, time, or timestamp
The name of the current database
The current user ID of the database user and the name of the user who last modified the row
The publisher user ID of the database for SQL Remote applications
A NULL value
A constant expression, as long as it does not reference database objects
A supported default value specified in a user-defined domain (data type) using the CREATE DOMAIN statement
Sybase IQ does not support the following values for column defaults:
Values that use the special values UTC TIMESTAMP, CURRENT UTC TIMESTAMP, and GLOBAL AUTOINCREMENT
A default value that is not compatible with the data type of the column
A default value that violates the check constraint of the table or column
A constant expression that references database objects
Sybase IQ ignores settings for the DEFAULT_TIMESTAMP_INCREMENT database option.