How to set an default value for an existing column in SQL Server ?

If you want to set an default value for an existing column in SQL Server , you can use the ALTER command and specify the CONSTRAINT.

How to set an default value for an existing column in SQL Server ?

Assume that you have a table called HumanResource.Employee and wish to set the “holiday” column’s default value to 23 . Here’s how you do it.

Use AdventureWorks
GO
ALTER TABLE HumanResource.Employee ADD CONSTRAINT DF_Constraint1 DEFAULT 23 FOR holiday


Leave a Reply