How to add check constraint in field by SQL Script

Veröffentlicht am: 13 Februar 2019
auf dem Kanal: ITSolution
21
0

How to add check constraint in field by SQL Script:
In this video I have shown how to add a check constraint in SQL Server table field by design view.
Suppose in SQL field one field we have to fill the value within a range or have to maintain a range when we insert data in the table. For this case we can set it by creating check constraint by which every data will by checked through the constraint and will show an error if data is out of range.
These process can be done by to ways : by design view and SQL script .
here I have shown how to do to do it by design SQL script

To do this we have to create table then alter the table
Designer process:

We can also set it from design view when creating table or after creating table:
For doing this click on the field in table design option then see constraint tab -- Right mouse - Create new constraint -- Set required expression -- Set Name of constraint -- Close

Syntax of check constraint:

ALTER TABLE tableName
ADD CONSTRAINT ConstraintName CHECK (EXPRESSION…)


To find the code I have written in this video, join to our facebook group by clicking following link:

https://www.facebook.com/permalink.ph...

You can also like to our facebook Page to get all video code clicking on following link:

https://www.facebook.com/permalink.ph...

You can follow us on twitter clicking on following link:

  / itsolut62078624  

We will create thousands of video related with information technology from our practical experience and those are used in our daily work and development. Stay with us.

Do like, share and comments and subscribe to my channel and click on bell button to get notification when new video uploaded. You may suggest me to make new video with new topic.
My Channel Subscription link:

   / @itsolution8998  

Thanks again


Auf dieser Seite können Sie das Online-Video How to add check constraint in field by SQL Script mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer ITSolution 13 Februar 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 21 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!