sql server change table name code example

Example 1: rename table sql server

USE AdventureWorks2012;   
GO  
EXEC sp_rename 'Sales.SalesTerritory', 'SalesTerr';

Example 2: how to change the column name in sql

ALTER TABLE table_name
CHANGE COLUMN old_name TO new_name;

Example 3: alter table name sql

-- Microsoft SQL style
EXEC sp_rename 'TableOldName', 'TableNewName';

Example 4: change column name in sql

MySQL:
ALTER TABLE Customer CHANGE Address Addr char(50);

Oracle:
ALTER TABLE Customer RENAME COLUMN Address TO Addr;

Example 5: change column name sql

ALTER TABLE users
 ALTER COLUMN first username varchar(20);

Tags:

Sql Example