Check Constraint is used for check the value before inserting in to the table.
It is called validation process in software industry.
Below is Syntax for Check Constraint:
ALTER TABLE [TableName]
WITH
CHECK ADD CONSTRAINT [ConstraintName] CHECK
((Condition))
Example:
ALTER TABLE [dbo].[Employee]
WITH
CHECK ADD CONSTRAINT [CK_Employee] CHECK
(([EmployeeId]<>''))
This example is used for Employee table .This Constraint not allowed the '' value in to the Table.
It is called validation process in software industry.
Below is Syntax for Check Constraint:
ALTER TABLE [TableName]
WITH
CHECK ADD CONSTRAINT [ConstraintName] CHECK
((Condition))
Example:
ALTER TABLE [dbo].[Employee]
WITH
CHECK ADD CONSTRAINT [CK_Employee] CHECK
(([EmployeeId]<>'
This example is used for Employee table .This Constraint not allowed the '
No comments:
Post a Comment