From the course: Microsoft SQL Server 2019 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Check constraints

Check constraints - SQL Server Tutorial

From the course: Microsoft SQL Server 2019 Essential Training

Start my 1-month free trial

Check constraints

- [Instructor] When your data is expected to meet some criteria, you can ensure that what gets entered into your data tables is valid with a check constraint. Check constraints are similar to the data validation features of spreadsheet programs like Excel. With a check constraint on your table, SQL Server will make sure that the values that are being written to your data tables meet the requirements that you specified. I want to add a check constraint to the Landon Hotel guest table. So I'm going to right-click on it and go into design. To add a check constraint to your data table click on the manage check constraint buttons on the toolbar here or you can right-click on any field and choose check constraints from the popup menu. Check constraints are a table-level property. They're not attached to any specific column so it doesn't matter which column you right-click on to get here. That will open up the check constraints window. I'll go ahead and press the add button to add in a new…

Contents