How to Rename Table in SQL Server with an example?. To demonstrate the Rename Table name, we are going to use the below-shown Customer table.
SQL Rename Table Name Example
In SQL, there is a stored procedure called SP_RENAME to rename Table name. In this example, we will rename the Customer table using this sp.
The syntax behind this rename table name approach is as shown below:
-- Syntax for SQL Server rename table Name is: SP_RENAME '[Old Table Name]', '[New Table Name]'
We are going to use the above-specified syntax to rename the Customers table to NewCustomers
Rename Table using SSMS
Let me change the table name to CustomersTable
You can see the changed table name
Sql Server Rename Table – Approach 2
To rename a table, 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.
Please change the table name as per your requirement. For now, we are changing the table name to Customers
From the below screenshot, you can see the new table name