Reputation: 69
I know sql but I when i tried few things to change a column name in sql entreprise edition 2012 (in sql server management studio) it doesn't work
what i tried:
alter table Table_name rename column oldName to newName;
Update Table_name set oldName= newName;
with a couple similar things also but no result always an error about rename not recognized etc..
Upvotes: 1
Views: 584
Reputation: 1786
use sp_rename
to rename your column
EXEC sp_rename 'Sales.SalesTerritory.TerritoryID', 'TerrID', 'COLUMN';
http://blog.sqlauthority.com/2008/08/26/sql-server-how-to-rename-a-column-name-or-table-name/
https://msdn.microsoft.com/en-us/library/ms188351.aspx
Upvotes: 2