Difference between revisions of "NULL Column Constraint"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
 
Line 19: Line 19:
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
set sql to recital
+
ALTER TABLE customer;
exec sql
+
  ADD COLUMN custref CHAR(5) NULL
ALTER TABLE customer ADD COLUMN custref char(5) NULL;
+
ALTER TABLE customer;
exec sql
+
  ALTER COLUMN custref NOT NULL
ALTER TABLE customer ALTER COLUMN custref NOT NULL;
+
use customer
+
list dictionary
+
 
</code>
 
</code>
  

Latest revision as of 11:29, 22 December 2009

Purpose

Column constraint to allow NULL values


Syntax

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 NULL column constraint is used to specify that the column can contain NULL values. The NOT NULL column constraint can be used to disallow NULL values.


Example

ALTER TABLE customer;
  ADD COLUMN custref CHAR(5) NULL
ALTER TABLE customer;
  ALTER COLUMN custref NOT NULL


Products

Recital, Recital Server