Add a column with a default value to an existing table in SQL Server

By | June 11, 2018

Syntax:

ALTER TABLE {TABLENAME} 
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} 
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
WITH VALUES

Example:

Alter table Employee

Add Address varchar(max) null default 'Pune'

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *