Is DEFAULT a constraint?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric Bragas

    Is DEFAULT a constraint?

    Hi,

    I see the following in Books Online: CONSTRAINT--Is an optional keyword
    indicating the beginning of a PRIMARY KEY, NOT NULL, UNIQUE, FOREIGN
    KEY, or CHECK constraint definition...

    But I have a table column defined as follows:

    [MONTH] [decimal] (2, 0) NOT NULL CONSTRAINT
    [DF__TBLNAME__MO NTH__216361A7] DEFAULT (0)

    My question: Is "DEFAULT" a constraint, or is it called something else?

    Thanks,
    Eric

  • Erland Sommarskog

    #2
    Re: Is DEFAULT a constraint?

    Eric Bragas (ericbragas@yah oo.com) writes:
    I see the following in Books Online: CONSTRAINT--Is an optional keyword
    indicating the beginning of a PRIMARY KEY, NOT NULL, UNIQUE, FOREIGN
    KEY, or CHECK constraint definition...
    >
    But I have a table column defined as follows:
    >
    [MONTH] [decimal] (2, 0) NOT NULL CONSTRAINT
    [DF__TBLNAME__MO NTH__216361A7] DEFAULT (0)
    >
    My question: Is "DEFAULT" a constraint, or is it called something else?
    There are actually two sorts of defaults: bound defaults and default
    constraints. Bound defaults are deprecated, but are useful when you
    bind them to types.

    What you have above, is indeed a default constraints.


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    • Eric Bragas

      #3
      Re: Is DEFAULT a constraint?

      Thank you for the clarification.

      Comment

      Working...