Rename column SQL Server 2008
Use sp_rename
EXEC sp_RENAME 'TableName.OldColumnName' , 'NewColumnName', 'COLUMN'
See: SQL SERVER – How to Rename a Column Name or Table Name
Documentation: sp_rename (Transact-SQL)
For your case it would be:
EXEC sp_RENAME 'table_name.old_name', 'new_name', 'COLUMN'
Remember to use single quotes to enclose your values.
Alternatively to SQL
, you can do this in Microsoft SQL Server Management Studio. Here are a few quick ways using the GUI:
First Way
Slow double-click on the column. The column name will become an editable text box.
Second Way
Right click on column and choose Rename from the context menu.
For example:
Third Way
This way is preferable for when you need to rename multiple columns in one go.
- Right-click on the table that contains the column that needs renaming.
- Click Design.
- In the table design panel, click and edit the textbox of the column name you want to alter.
For example:
NOTE: I know OP specifically asked for SQL solution, thought this might help others :)