| title | Rename Tables (Database Engine) | ||||
|---|---|---|---|---|---|
| description | Learn how to rename a database table. | ||||
| author | WilliamDAssafMSFT | ||||
| ms.author | wiassaf | ||||
| ms.date | 08/07/2025 | ||||
| ms.service | sql | ||||
| ms.subservice | table-view-index | ||||
| ms.topic | how-to | ||||
| ms.custom |
|
||||
| helpviewer_keywords |
|
||||
| monikerRange | =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb |
[!INCLUDE sqlserver2016-asdb-asdbmi-fabricsqldb]
This article covers how to rename a table in a database.
To rename a table in Azure Synapse Analytics or Parallel Data Warehouse, use RENAME (Transact-SQL).
Caution
Think carefully before you rename a table. If existing queries, views, user-defined functions, stored procedures, or programs refer to that table, the name modification makes these objects invalid.
Renaming a table doesn't automatically rename references to that table. You must manually modify any objects that reference the renamed table. For example, if you rename a table and that table is referenced in a trigger, you must modify the trigger to reflect the new table name. Use sys.sql_expression_dependencies to list dependencies on the table before renaming it.
Requires ALTER permission on the table.
Install the latest version of SQL Server Management Studio (SSMS).
-
In Object Explorer, right-click the table you want to rename and choose Design from the shortcut menu.
-
From the View menu, choose Properties.
-
In the field for the Name value in the Properties window, type a new name for the table.
-
To cancel this action, press the Escape (ESC) key before leaving this field.
-
From the File menu, choose Save table name.
-
In Object Explorer, connect to an instance of [!INCLUDE ssDE].
-
On the Standard bar, select New Query.
-
The following example renames the
SalesTerritorytable toSalesTerrin theSalesschema. Copy and paste the following example into the query window and select Execute.USE AdventureWorks2022; GO EXEC sp_rename 'Sales.SalesTerritory', 'SalesTerr';
Important
The sp_rename syntax for @objname should include the schema of the old table name, but @newname does not include the schema name when setting the new table name.