SQL Server Default Constraint is used to assign default values to the table columns. In general, every column accepts either Nulls or Values. If the user forgot to enter the value, then Server will assign a NULL value to the column. In those cases, we can use the Default constraint to replace those Nulls with the standard value.
Set SQL Default Constraint using Management Studio
We can create a Default Constraint using both the Transact query and the Management Studio.
To create a SQL Server Default Constraint using Management Studio, please go to Object Explorer. Expand the Database folder in which the table had. Please select the table to create it (here it is Custrecords), and right-click on it will open the context menu. Please select the Design option.

Once you click the Design option, the management studio will open the corresponding table in design mode. As you see, the table had seven columns of different data types, and our task was to add the SQL Default Constraint to the Profession column.
Please select the Column name and provide the default values at the Default Value or Binding Column property. We are assigning the Software Developer as the standard value for the profession column for this default example.
Let me insert a value into the SQL Server table using the INSERT Statement.
INSERT INTO [dbo].[CustRecords] ([CustKey], [FirstName], [LastName], [BirthDate], [EmailAddress], [Yearly Income]) VALUES (1, 'Imran', 'Khan', '10-08-1985', 'abc@abc.com', 15900, 'Skilled Professional') GO
Messages
--------
(1 row(s) affected)
Let me show you the Data.
Though it has the default values, it is inserting the data I want to insert. Now, Let me insert the values without the profession column.
INSERT INTO [dbo].[CustRecords] ([CustKey], [FirstName], [LastName], [BirthDate], [EmailAddress], [Yearly Income]) VALUES (2, 'Steve', 'Williams', '10-04-1989', 'abcd@abcd.com', 15500), (3, 'Doe', 'Lara', '10-08-1985', 'xyz@abc.com', 15000 ), (4, 'Ramesh', 'Kumar', '10-08-1985', 'mnop@abc.com', 65000) GO
It is inserting the default values into the profession column.
Create SQL Server Default Constraint using query
Let us create a default constraint using the Transact statement. Here, we will set the default values at the time of table creation.
Please refer to Create Table article.
-- Example CREATE TABLE [dbo].[CustRecords]( [CustKey] [int] NOT NULL PRIMARY KEY, [FirstName] [varchar](50) NOT NULL, [LastName] [varchar](50) NULL, [BirthDate] [date] NULL, [EmailAddress] [nvarchar](50) NULL, [Yearly Income] [money] NULL, [Profession] [nvarchar](100) NOT NULL DEFAULT ('Software Developer'), ) GO
OR
CREATE TABLE [dbo].[CustRecords]( [CustKey] [int] NOT NULL PRIMARY KEY, [FirstName] [varchar](50) NOT NULL, [LastName] [varchar](50) NULL, [BirthDate] [date] NULL, [EmailAddress] [nvarchar](50) NULL, [Yearly Income] [money] NULL, [Profession] [nvarchar](100) NULL CONSTRAINT [DF_CustRecords_Profession] DEFAULT ('Software Developer'), ) GO
Messages
--------
Command(s) completed successfully.
We added it with the standard value of Software Developer. It is the same as we create any other constraint. The SSMS is intelligent enough to set the default value for you. Let me insert the values without the profession column.
INSERT INTO [dbo].[CustRecords] ([CustKey], [FirstName], [LastName], [BirthDate], [EmailAddress], [Yearly Income]) VALUES (1, 'Tutorial', 'Gateway', '10-04-1995', 'ab@abd.com', 12500), (2, 'Steve', 'Smith', '10-04-1989', 'abcd@abcd.com', 15500), (3, 'Jack', 'Lara', '10-08-1985', 'xyz@abcd.com', 15000 ), (4, 'Ramesh', 'Kumar', '10-05-1983', 'mnopq@abcs.com', 65000) GO
Add Default Constraint on Existing table
How to add Default Constraint in SQL Server to the existing table? For this, we create a new table.
CREATE TABLE [dbo].[CustRecords]( [CustKey] [int] NOT NULL PRIMARY KEY, [FirstName] [varchar](50) NOT NULL, [LastName] [varchar](50) NULL, [BirthDate] [date] NULL, [EmailAddress] [nvarchar](50) NULL, [Yearly Income] [money] NULL, [Profession] [nvarchar](100) NOT NULL ) GO
Now let me add to the above table. As you can see from the below, we are using the Alter Table Statement to alter the table content. Then used the ADD Constraint statement to add the default constraint.
ALTER TABLE [dbo].[CustRecords] ADD CONSTRAINT DF_CustRecords_Profession DEFAULT ('Software Developer') FOR Profession; GO
Let me show you the internal code generated by right-clicking on the table -> script as – > create to new query window option.
Delete Default Constraint using SSMS
Please select the table -> Column on which you want to add, then go to the Column properties and remove the default value.
Delete or Drop the Default Constraint
If you know the Default name, use the SQL Server DROP Constraint statement along with the ALTER TABLE Statement.
ALTER TABLE [dbo].[CustRecords] DROP CONSTRAINT DF_CustRecords_Profession; GO
If you don’t know the name, use the first SELECT Statement to get all the Constraint names.
-- To find the Name SELECT name FROM sys.default_constraints WHERE OBJECT_NAME(parent_object_id) = N'CustRecords'; GO -- Delete or Drop ALTER TABLE [CustmerRecords] DROP CONSTRAINT DF_CustRecords_Profession