SQL Default Constraint

05-06-2019  0 Comment(s)

SQL Default Constraint is used to assign default values to the SQL table columns. In general, every column accepts either Nulls, or a Value. If the user forgot to enter the value then SQL Server will assign NULL value to the column. In those cases, we can use the SQL Server Default constraint to replace those Nulls with default value.

In this article we will show you, how to assign default values in SQL server with examples.

Create SQL Default Constraint

We can create a SQL Server Default Constraint using both the Transact SQL query, and the Management Studio.

Set SQL Default Constraint using SSMS

In this example, we will show you, How to create a Default Constraint in SQL server using the SQL server management Studio. To do so, Please go to the Object Explorer.

Within the object explorer, Expand the Database folder in which the table had. Please select the table on which you want to create a Default Constraint (here it is Custrecords), and Right click on it will open the context menu. Please select Designoption as shown below

Comment Here


No Comments to Show