Click here to Skip to main content
14,425,567 members
Rate this:
Please Sign up or sign in to vote.
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 9:39am
v2
Comments
Manas_Kumar 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

Rate this:
Please Sign up or sign in to vote.

Solution 2

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:
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.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100