Developing By Me

Project Development and Design

RENAME TABLE

    The last option to MODIFY a table is the ability to rename the table. Like other modifications this requires FOREIGN KEY constraints to be removed prior to the action. After this has been done any constraints can be reapplied and the database will have no performance changes. However, it is important to understand that changing a table name will affect anything that references the old name. This can be a problem if the table is used often and should not be done without great care and consideration.

 

SQL Syntax SQL Database
EXEC sp_rename ‘old_name’, ‘new_name’ SQL Server
RENAME TABLE old_name TO new_name MySQL
ALTER TABLE old_name RENAME TO new_name Oracle, PostgreSQL

 

%d bloggers like this: