alter table rename column sql server code example

Example 1: rename table sql

ALTER TABLE STUDENTS  
RENAME TO ARTISTS;

Example 2: sql rename column

EXEC SP_RENAME 'TABLE_NAME.OLD_COLUMN_NAME','NEW_COLUMN_NAME'

Example 3: how to change a collumn name in sql

ALTER TABLE `table_name` 
CHANGE `old_name` `new_name` VARCHAR(10) 
CHARACTER SET utf8 
COLLATE utf8_general_ci NULL 
DEFAULT NULL;

Example 4: how to change column name in sql

ALTER TABLE Student RENAME COLUMN NAME TO FIRST_NAME;
ALTER TABLE `Table Name` MODIFY COLUMN `Column Name` Datatype(Size);

Example 5: how to rename columns in sql server

EXEC sp_rename 'Sales.SalesTerritory.TerritoryID', 'TerrID', 'COLUMN';

Example 6: add multiple field in table sql

ALTER TABLE employee
  ADD (
  	  last_name VARCHAR(50) NOT NULL,
      first_name VARCHAR(40) NOT NULL
      );

Tags:

Sql Example