Column Definitions

Considerations for creating a column from a user-defined datatype.

  • You cannot change the length, precision, or scale.

  • You can use a NULL type to create a NOT NULL column, but not to create an IDENTITY column.

  • You can use a NOT NULL type to create a NULL column or an IDENTITY column.

  • You can use an IDENTITY type to create a NOT NULL column, but the column inherits the IDENTITY property. You cannot use an IDENTITY type to create a NULL column.

Only columns with variable-length datatypes can store null values. When you create a NULL column with a fixed-length datatype, the SAP ASE server automatically converts it to the corresponding variable-length datatype. The SAP ASE server does not inform the user of the type change.

This table lists the fixed-length datatypes and the variable-length datatypes to which they are converted. Certain variable-length datatypes, such as moneyn, are reserved types that cannot be used to create columns, variables, or parameters:

Variable-Length Datatypes Used to Store Nulls

Original Fixed-Length Datatype

Converted to

char

varchar

nchar

nvarchar

binary

varbinary

datetime

datetimn

float

floatn

bigint, int, smallint, tinyint

intn

unsigned bigint, unsigned int, unsigned smallint

uintn

decimal

decimaln

numeric

numericn

money and smallmoney

moneyn

For a report on a table and its columns, execute the system procedure sp_help.

You can create column defaults in two ways: by declaring the default as a column constraint in the create table or alter table statement, or by creating the default using the create default statement and binding it to a column using sp_bindefault.