How to rename a column in SQL Server ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

One of the options for the user to rename a column in SQL Server is using the so_rename stored procedure and specifying the parameters.

Here’s the syntax of the sp_rename.

EXEC sp_rename '<TableName.<columnName>>' , 'newColumnName', 'COLUMN'

For example , if you want to rename the column description in the temp_abundantcode table to comment , this is how it looks.

Use AdventureWorks
GO
EXEC sp_rename 'temp_abundantcode.[description]' , 'comment', 'COLUMN'
%d bloggers like this: