techie techie -4 years ago 117
SQL Question

Change column name in SQL Server 2008

How to change predefined column name to a new name.

eg: Column name is "Accounts"
I want to change it to "A/c"


alter table emp change Accounts....[What next]

Answer Source

You need to use the sp_rename command, or use Management Studio to do it visually - make sure you do it at a quiet period, and make sure it has been done in pre-production first with testing!

Incidentally I would keep away from A/C - the slash sign is special meaning division.

The documentation for sp_rename is here, example B is most appropriate. http://msdn.microsoft.com/en-us/library/ms188351.aspx

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download