Click here to Skip to main content
16,019,087 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi how to rename table's column in sql server? with "alter" command
plz help me!
Posted

SQL
Two possible SQL statements are:

Code:
ALTER TABLE tablename RENAME COLUMN OldName TO NewName
or
Code:
ALTER TABLE tablename RENAME OldName TO NewName
 
Share this answer
 
Comments
SoMad 4-Apr-13 0:13am    
Don't use the ALTER command:
SQL
sp_RENAME 'MyTable.OldColumnName' , 'NewColumnName', 'COLUMN'
 
Share this answer
 
Comments
alirezamilani 18-Oct-12 5:51am    
thx a lot OriginalGriff
OriginalGriff 18-Oct-12 6:01am    
You're welcome!
KUMAR619 13-Jan-15 13:01pm    
Can we rename Column name without using sp_RENAME or by design?

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