From the course: Microsoft SQL Server 2022 Essential Training

Unlock this course with a free trial

Join today to access over 24,100 courses taught by industry experts.

Check constraints

Check constraints

- [Instructor] When your data is expected to meet some criteria, you can ensure that what gets entered is valid with a check constraint. Check constraints are very 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've specified. I want to add a check constraint to the Red30 Tech customers table. So I'll right-click on it and open it up in the design window. To add a check constraint to your data table, click on the Manage Check Constraint button up here in the toolbar. Looks like a little grid, or you can right-click on any column, and in the popup menu, there's also an option to go to your check constraints. Check constraints are a table-level property. They're not really attached to any specific column, so it doesn't really matter…

Contents