Syntax For Creating Constraints...
Alter Table <Table_Name>
ADD CONSTRAINT [Constraint_Name] DEFAULT (1) FOR <Column_Name>
GO
Syntax For Dropping The Constraint...
Alter Table <Table_Name>
Drop Constraint [<Constraint_Name>]
To List All the Constraints in a Data Base Here is this Code...
Alter Table <Table_Name>
ADD CONSTRAINT [Constraint_Name] DEFAULT (1) FOR <Column_Name>
GO
Syntax For Dropping The Constraint...
Alter Table <Table_Name>
Drop Constraint [<Constraint_Name>]
To List All the Constraints in a Data Base Here is this Code...
SELECT OBJECT_NAME(OBJECT_ID) AS NameOfTheConstaraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
GO
No comments:
Post a Comment