Alter (Rename) Table in SQL Server using SP_Rename Query or Management Studio

  Total Views : 492
  Comments : 0
 
  Keywords : How to alter / rename table in sql server using script, Alter / rename table in sql server management studio,SP_Rename statement in sql to rename / alter table, Alter table name in sql

Here we will learn how to rename or change sql server table name using sp_rename statement or sql server management studio with examples.

SQL Server ALTER or Change Table Name

To alter or rename or change name of table in SQL database we have two different methods one is using ”SP_RENAME” Query and another one is directly using SQL Server Management Studio

Using SP_RENAME Query to ALTER / Rename SQL Table

By using “SP_RENAME” statement we can change name of SQL Table. Generally to alter or rename / change table name in SQL our syntax will be like as shown below

Syntax to ALTER / Rename SQL Table using Query

Following is the syntax to rename table in sql server using sp_rename statement

 

SP_RENAME 'oldtablename', 'newtablename'

Here “oldtablename” means name of the present table and “newtablename” means its new name for table.

Example to ALTER / Rename SQL Table using Query

The following SQL statements will rename or change table name from “EmployeeDetails” to “EmployeeInformation”. 

 

SP_RENAME 'EmployeeDetails', 'EmployeeInformation'

Now refresh your sql database section and check for table with new name that would be like as shown below

 

After changing or renaming table name in sql server

ALTER / Rename SQL Table using SQL Server Management Studio

To change table name open SQL Server Management Studio à Select your database in Databases section --> Go to Tables Section --> Select your table --> Right click and Select Rename Table like as shown below  

 

Rename table in SQL Server using Management Studio

Once we click on Rename option it will allow us to modify table name in that enter required table name. Once we change table name that will be like as shown below

 

After changing or renaming table name in sql server

 Comments (0)

Be the first to give your valuable feedback

Leave a comment

  • Default Tutlane User