Alter table

SQL Alter table

To add, modify, delete a column from a table uses the command ALTER TABLE.

SQL Add Column syntax

ALTER TABLE my_table ADD new_column_name data_type;

SQL Alter Column syntax

ALTER TABLE my_table ALTER COLUMN column_name new_data_type;

SQL Drop Column syntax

ALTER TABLE my_table DROP COLUMN column_name;

SQL Rename Column syntax

EXEC sp_rename ‘table_name.old_column_name’, ‘new_column_name’, ‘COLUMN’;

SQL Rename Table syntax

EXEC sp_rename ‘table_name’, ‘new_table_name’;