SQL Alter Table Name

SQL Alter Table Name is used to change or modify name of the existing table.

SQL Alter Table Name


SQL Alter Table Name is used to change or modify  name of the existing table. To understand how to change the name of created table in SQL Query, this tutorial brings you a simple example to understand it.

The Table 'Stu_Table' is created using create table statement. The insert into statement add records or rows to the table 'Stu_Table'. The inserted record from a table 'Stu_Table' is returned by the select statement. Now we want to change the name of Table 'Stu_Table' to 'Stu_Tab_10'. The Alter table Query will run ,which alter the name of existing table 'Stu_Table'. The Rename Query rename the Table 'Stu_Table' to 'Stu_Table_10'.Once the query is submitted, the successful Rename is displayed. 

Create Table Stu_Table

create table Stu_Table(Stu_Id integer(2), Stu_Name varchar(15), Stu_Class  varchar(10))

Insert data into Stu_Table

insert into Stu_Table values(1,'Komal',10);
insert into Stu_Table values(2,'Ajay',10);
insert into Stu_Table values(3,'Rakesh',10);
insert into Stu_Table values(4,'Bhanu',10);
insert into Stu_Table values(5,'Santosh',10);


Stu_Id Stu_Name Stu_Class
1 Komal 10
2 Ajay 10
3 Rakesh 10
4 Bhanu 10
5 Santosh 10

SQL Alter Query


Alter table Stu_Table rename to Stu_Table_10)


Successful Rename ...




We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.

Share on Google+Share on Google+

SQL Alter Table Name

Posted on: December 20, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: SQL Alter Table Name   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
nasir ahmed
August 14, 2012
sql table name changing

Alter table Stu_Table rename to Stu_Table_10.... this code is show an error, it shows invalid for rename
August 30, 2012

Alter table Stu_Table rename to Stu_Table_10
September 30, 2013
alter table

alter table old_table_name rename to new_table_name is not working
Raman Singh
December 26, 2013
Check thats one

exec sp_rename old_name , New_name