In SQL, we can alter or rename or change the table's name in the SQL database either by using the”SP_RENAME” query or by using SQL Server Management Studio.
In SQL, by using the “SP_RENAME” statement, we can change the name of Table in the database based on our requirements.
Following is the syntax of alter or rename the table in SQL server using sp_rename statement.
Here “oldtablename” is the name of the present table, and “newtablename” is the new name for the table.
Following is the example query to change or rename the table name from “EmployeeDetails” to “EmployeeInformation”.
Now refresh your SQL database section and check for the table with a new name, as shown below.
To change the 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.
Once we click on the Rename option, it will allow us to modify a table name to enter a required table name. Once we change the table name, that will be like as shown below.