Difference between revisions of "NOT NULL Column Constraint"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Column constraint to disallow NULL values | Column constraint to disallow NULL values | ||
Line 26: | Line 19: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | ALTER TABLE customer; | |
− | + | ADD COLUMN custref CHAR(5) NULL | |
− | ALTER TABLE customer ADD COLUMN custref | + | ALTER TABLE customer; |
− | + | ALTER COLUMN custref NOT NULL | |
− | ALTER TABLE customer ALTER COLUMN custref NOT NULL | + | |
− | + | ||
− | + | ||
</code> | </code> | ||
==Products== | ==Products== | ||
− | Recital | + | Recital, Recital Server |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] |
Latest revision as of 11:28, 22 December 2009
Purpose
Column constraint to disallow NULL values
Syntax
NOT NULL
See Also
ALTER TABLE, CONSTRAINTS, CREATE TABLE
Description
A constraint is used to define rules that help to provide data integrity. Column constraints are specific to the column name specified. You must have ALTER privilege on the table. The table will be locked for EXCLUSIVE use during the operation.
The NOT NULL column constraint is used to specify that the column cannot contain NULL values. The NULL column constraint can be used to allow NULL values.
Example
ALTER TABLE customer; ADD COLUMN custref CHAR(5) NULL ALTER TABLE customer; ALTER COLUMN custref NOT NULL
Products
Recital, Recital Server