1 Hi Vipendra,
CHECK Constraint
The CHECK constraint is used to limit the value range that can be placed in a column.
If you define a CHECK constraint on a single column it allows only certain values for this column.
If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row.
SQL CHECK Constraint on CREATE TABLE
The following SQL creates a CHECK constraint on the "P_Id" column when the "Persons" table is created. The CHECK constraint specifies that the column "P_Id" must only include integers greater than 0.
CREATE TABLE Persons
(
P_Id int NOT NULL CHECK (P_Id>0),
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
Please refer the below links
http://www.w3schools.com/sql/sql_check.asp
http://msdn.microsoft.com/en-us/library/ms188258%28v=sql.105%29.aspx
http://www.databasejournal.com/features/mssql/article.php/3811831/Using-Check-Constraints-to-Validate-Data-in-SQL-Server.htm
Thanks
0 Check constraints most of the times replaces triggers to check any changes in data like update, delete and insert.
0 Check constraint will inspect the value before it enters the table. Say for example you have bonusPercent as column in table bonus. Using check constraint you can make sure the value entered in the column lies between 5% to 15%. The value beyond that range is treated as constraint violation.
Refer the Link:
DB Constraints