In SQL Add Column is used to add a new column to the existing table. For this Sql Server alter table add column demonstration, We are going to use the below-shown Customer table.
SQL Add Column example
To add a new column to the existing table, please use the following Alter table Add Column syntax
-- SQL Server Add Column ALTER TABLE [Table_Name] ADD [New_Column] Data_Type (Length) NULL | NOT NULL
In this SQL example, we are going to add Sales Column that allows Nulls to an existing Customers table
-- SQl Server Add Column Example USE [NewNameDB] GO ALTER TABLE Customers ADD Sales MONEY NULL
From the above code snippet you can see that, we added Sales Column of Money data type, and it will allow NULL Values
From the below screenshot you can see the new column
Add Column using SSMS
If you can access the Management Studio, then you can use the following steps to add a new column in SQL Server. Right-click on the table, and select the Design from the context menu.
Selecting the Design option will open the table in design mode.
Let me a add new column called Tax, and the data type that we assigned was Money
Click the Close button will display the pop-up window. Please select the Yes button to save the changes that you made in the design window.
Now you can see the newly added column called the tax.