A domain is a user-defined data type that, together with other attributes, can restrict the range of acceptable values or provide
defaults. A domain extends one of the built-in data types. The range of permissible values is usually restricted by a check
constraint. In addition, a domain can specify a default value and may or may not allow NULLs.
You can define your own domains for a number of reasons.
- A number of common errors can be prevented if inappropriate values cannot be entered. A constraint placed on a domain ensures
that all columns and variables intended to hold values in a range or format can hold only the intended values. For example,
a data type can ensure that all credit card numbers typed into the database contain the correct number of digits.
- Domains can make it much easier to understand applications and the structure of a database.
- Domains can prove convenient. For example, you may intend that all table identifiers are positive integers that, by default,
auto-increment. You could enforce this restriction by entering the appropriate constraints and defaults each time you define
a new table, but it is less work to define a new domain, then simply state that the identifier can take only values from the
For more information about domains, see SQL data types.
Creating domains (Sybase Central)
Creating domains (SQL)