How do add a column to a table in SQL Server
Loading
How do add a column to a table in SQL Server
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandhiya PriyaPosted Oct 24, 2025, 4:11 AM
In SQL Server, you can add a new column to an existing table using the
ALTER TABLEstatement.Syntax:
Example 1: Add a simple column
This adds a new column called
Departmentto theEmployeestable.Example 2: Add a column with a default value
Adds a column
IsActivethat:Has data type
BIT(boolean),Cannot be
NULL,Defaults to
1(true) for all existing rows.Example 3: Add multiple columns at once
Adds two columns
JoiningDateandSalaryto the table.Notes:
Adding a
NOT NULLcolumn without a default value will fail if the table already contains data.If you add a
DEFAULTconstraint, existing rows will automatically get the default value.Ajay BansodePosted Aug 20, 2025, 7:26 AM
If you want to add a new column in SQL Server, you can use the
ALTER TABLEstatement.Syntax:
Example 1: Add a nullable column
MiddleNameof typeVARCHAR(50)that can containNULL.Example 2: Add a NOT NULL column with default value
CreatedDatecolumn with default current date/time for existing and new rows.Example 3: Add multiple columns
If table already has rows, adding a
NOT NULLcolumn requires a DEFAULT value.Always check dependencies (views, stored procedures) before altering a table in production.
Pankajkumar PatelPosted Aug 13, 2025, 5:41 AM
Hi Kiran Kumar,
You can add a column to an existing table in SQL Server, using the ALTER TABLE statement.
Syntax:
Example:
Suppose you have a table Employees and you want to add a column named DateOfBirth of type DATE which allows null values:
Hope this will help you!