SQL Rename Table

How to Rename Table in SQL Server with an example? To demonstrate this, we use the below-shown Customer.

Customer records 1

SQL Server Rename Table Name Example

There is a stored procedure called SQL SP_RENAME to rename the table name. In this example, we will change the Customer using this sp. The syntax to use this sp_rename on the existing ones is as shown below.

SP_RENAME '[Old Name]', '[New TableName]'

We use the above sp_rename syntax to change the Customers to NewCustomers.

SQL Rename Table 2
Object Explorer 3

Rename Table using Management Studio

If you can access Management Studio, double-click on the SQL Server Table allows you to change the name. Let me change the name to the CustomersTable

using Management Studio 5

Rename Table using SSMS Approach 2

Within the Object Explorer, Go to the Database where it exists. Next, please Right click on it, and select Rename Table from the context menu.

SQL Rename Table using Management studio 7

We are changing the name to Customers, and from the below image, you can see the new one.

DBS in Object Explorer 9
Categories SQL