How to Rename Table in SQL Server with an example?. To demonstrate the Rename Table name, we use the below-shown Customer table.
SQL Rename Table Name Example
There is a stored procedure called SP_RENAME to rename the table name. In this example, we will rename the Customer table using this sp.
The syntax to rename table name using sp_rename
-- Syntax for SQL Server rename table Name is: SP_RENAME '[Old Table Name]', '[New Table Name]'
We use the above sp_rename syntax to rename the Customers table to NewCustomers
Rename Table using SSMS
If you can access Management Studio, double-click on the SQL Server Table allows you to change the table name.
Let me change the table name to CustomersTable
You can see the changed table name
Rename Table Name – Approach 2
To rename a table in SQL Server, within the Object Explorer, Go to the Database where the table exists. Next, Right-click on the Table, and select the Rename from the context menu.
We are changing the table name to Customers.
You can see the new table name