Following SQL query can be used to list all the default constraints of a tabled named ‘Department’:
SELECT DefaultConstraints.Name 'Constraint Name', DefaultConstraints.Definition 'Default Value'
FROM Sys.Default_Constraints DefaultConstraints INNER JOIN Sys.Objects SystemObjects
On SystemObjects.Object_Id = DefaultConstraints.Parent_object_Id
Where SystemObjects.Name = 'Department'
No comments:
Post a Comment