Click here to Skip to main content
15,884,731 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
alter table oldtable rename newtable;



I used rename command but its not working how i can rename a table name without using storeprocedure
Posted
Updated 1-Apr-16 8:39am
v2
Comments
[no name] 4-Feb-16 0:59am    
If it command executed successfully then it should rename perfectly. Secondly you can rename manually by double click on table name in SSMS tool.
jaket-cp 4-Feb-16 8:05am    
have a read of these:
sp_rename (Transact-SQL) - https://msdn.microsoft.com/en-GB/library/ms188351(v=sql.105).aspx
How to: Rename Tables (Visual Database Tools) - https://msdn.microsoft.com/en-us/library/aa337520(v=sql.105).aspx
they should help you out

Top two links:
http://lmgtfy.com/?q=mssql+rename+table

1 solution

This is an incredibly easy thing to google for. It is taking you longer to ask us than it is to ask google. For future reference, always google for how-to questions because the answers are out there.

However it is this easy:
SQL
EXEC sp_rename 'OldTableName', 'NewTableName';


And if you do not want to use the Stored Procedure, then right-click on the table in SSMS and rename it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900