Default Constraints

  • I am new to SQL Server programming. I want to list all the details about a default contraint. How do I do this?

    Thanks in advance.:cool:

  • This should do the job:

    SELECT OBJECT_NAME(d.parent_object_id) AS tablename,

    d.name AS defaultname,

    c.name AS columnname,

    definition

    FROM sys.default_constraints d

    JOIN sys.columns c

    ON d.parent_column_id = c.column_id

    AND d.parent_object_id = c.object_id

    ORDER BY TableName

    [font="Verdana"]Markus Bohse[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply