Search the Blog

Thursday, October 10, 2019

SQL Server constraint

CHECK constraint

A CHECK constraint can be applied to a column in a table to limit the values that can be placed in a column. Check constraint is to enforce integrity.

Sql Server Check Contraints Applicable query
After this if we used to insert the following query

insert into employees values(0,'Sawan','Chauan',24567)

Then following Output Message will be diplayed.
if SQL Constraints fails then following output will be displayed

Second Example of Query

SQL Server Check Constraints

When we try to insert the following -
Check Contraints complete query SQL server 2017
Then we will receive the above error



TRY----CATCH constructs

To handles exceptions by writing scripts inside the TRY block and error handling in the CATCH block

No comments:

Post a Comment

Translate