Skip to content
Mathias Rangel Wulff edited this page Jun 12, 2015 · 3 revisions

Keyword CHECK

AlaSQL supports CHECK table constraints.

Syntax:

    CREATE TABLE table (
        column type CHECK expression
    );

For example:

    CREATE TABLE dbo.Employees (
      empid   INT         NOT NULL PRIMARY KEY,
      mgrid   INT         NULL REFERENCES dbo.Employees,
      empname VARCHAR(25) NOT NULL,
      salary  MONEY       NOT NULL,
      CHECK (empid <> mgrid)
    );

You can use this constraint for whole table or for separate fields.

See also: CONSTRAINT

Clone this wiki locally