Export (0) Print
Expand All
Expand Minimize

sys.default_constraints (Transact-SQL)

Updated: 17 July 2006

Contains a row for each object that is a default definition (created as part of a CREATE TABLE or ALTER TABLE statement instead of a CREATE DEFAULT statement), with sys.objects.type = D.

Column name Data type Description

<Columns inherited from sys.objects>

 

For a list of columns that this view inherits, see sys.objects (Transact-SQL).

parent_column_id

int

ID of the column in parent_object_id to which this default belongs.

definition

nvarchar(max)

SQL expression that defines this default.

SQL Server 2005 differs from SQL Server 2000 in the way it decodes and stores SQL expressions in the catalog metadata. The semantics of the decoded expression are equivalent to the original text; however, there are no syntactic guarantees. For example, white spaces are removed from the decoded expression. For more information, see, Behavior Changes to Database Engine Features in SQL Server 2005.

is_system_named

bit

1 = Name was generated by system.

0 = Name was supplied by the user.

The following example returns the definition of the DEFAULT constraint that is applied to the VacationHours column of the HumanResources.Employee table.

SELECT d.definition FROM sys.default_constraints d
INNER JOIN sys.columns c
ON d.parent_column_id = c.column_id
WHERE d.parent_object_id = OBJECT_ID(N'HumanResources.Employee', N'U')
AND c.name = 'VacationHours';

Release History

17 July 2006

New content:
  • In the definition column, added content about how SQL expressions are stored in SQL Server 2005.
  • Added the example.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft