Adding a Column with Default Value to an Existing Table in SQL Server
In SQL Server, use the ALTER TABLE statement with the ADD clause to add a column with a default value to an existing table. The syntax is: ALTER TABLE TableName ADD ColumnName DataType DEFAULT DefaultValue. For example, to add IsActive column to Employees table with default value 1: ALTER TABLE Employees ADD IsActive BIT DEFAULT 1.
You must be logged in to post a comment.