|MS SQL Server 2012 - DBA Articles|
RENAME TABLE - Rename Table and Column Information
The sp_rename system procedure is used to rename an existing user defined table, column, index, alias data type or user-defined type name for the current database.
The sp_rename cannot be used to change system data types and system objects information.
INDEX name is automatically renames when PRIMARY KEY or UNIQUE constraint is renamed.
PRIMARY KEY constraint name is automatically renames when INDEX is renamed.
SQL Server does not recommend to rename stored procedure, function, view and trigger object name, when update this name the related object name does not rename.
Rename Existing Table Name
The following example is used to rename an existing Employee table name into EMP_TEST that stored in the default dbo schema of eBusiness database.
-- Rename Existing Table Name --
Rename Existing Column Name
The following example is used to rename an existing EMP_TEST table's Emp_Code column name into Emp_ID that stored in the default dbo schema of eBusiness database.
-- Rename Existing Column Name --
* * * * *