how to rename table name in sql?
-
Friday, June 13, 2008 9:19 AMhow to rename table name in sql?
i trid as like
rename table table_name to new_table_name
but this raises an error
All Replies
-
Friday, June 13, 2008 5:21 PM
Try sp_rename:
Code Snippetsp_rename 'old_table_name', new_table_name'
-
Sunday, June 29, 2008 5:34 PM
Once table name is renamed, please ensure you recompile your objects (SP, Trigger, View, Function), the ones that are using this Table, with the new name

- Proposed As Answer by peddi suryaBanned Wednesday, October 28, 2009 5:49 AM
-
Thursday, March 19, 2009 8:25 PMhi friend u can rename ur table from left side object explorer
first of all click on database and expand this then click on ur database name so u can c ur table name , after right click on that table name whose u want to rename
and click on rename option from ur right click pop menu
ok take care bye -
Wednesday, April 15, 2009 7:34 AMI guess your answer is useless
-
Tuesday, April 05, 2011 6:44 PM
HI JANARDHANA,
IT'S VERY SIMPLE TO RENAME THE TABLE SEE BELOW
SP_RENAME 'EXIST TABLE NAME ','NEW TABLE NAME'
EG
SP_RENAME 'EMP','EMPLOYEE'
- Proposed As Answer by NISHA BALWATKAR Tuesday, September 27, 2011 11:04 AM
-
Tuesday, September 27, 2011 11:04 AMThis worked. Thank you very much.
-
Friday, December 02, 2011 5:34 AM
I see your answer Mr. bulandraza. But i am extremely sorry that there is no option to rename the way you explaining.
Please first do practical on the answers and then write. You are guiding wrong to the fresher and answer needer.
-
Friday, December 02, 2011 5:59 AM
I am explaining the answer in steps by steps so it is very easy to understand for freshers.
- First select the the table you want to rename in Server Explorer.
- Right click with mouse on the the table and then select New Query.
- It will show all tables in the small window and select the table you want to rename and then close.
- A query is written in the bottom. Delete it and just write your required query.
Delete the select query and write sp_rename 'oldtablename','newtablename'
By taking the example of upper table the query would be
sp_rename 'tb_adminlogin','adminlogin'
Hope this answer help all the seekers for this question. -
Wednesday, July 18, 2012 5:39 AM
Hi,
Re-Naming Column:
USE AdventureWorks
GO
sp_RENAME 'Table_First.Name', 'NameChange' , 'COLUMN'
GORe-Naming Table:
sp_RENAME 'Table_First', 'Table_Last'
GOThanks Shiven:) If Answer is Helpful, Please Vote
-
Thursday, August 02, 2012 6:07 PMActually, Bulandraza's option is valid. I use it all the time.
- Edited by vnns Thursday, August 02, 2012 6:09 PM

