SQL Server Alter

SQL Server Alter command is used to modify the structure of a table. With alter command we can add new column, drop column and modify the column.


Alter table table_name
add/drop/modify column datatype

Table structure is used in this example.

Add new column to emp table
alter table emp
add email varchar(25)

Change the datatype of table column.
aleter table emp
alter column email varhcar(35) not null

Drop a column from the table emp.
alter table emp
drop column email

Add unique constraint to the table.
alter table emp
add constraint x unique(email)

Powered by k2schools