How to rename a column in SQL Server ?

Published on August 29, 2016 by abundantcode

Filed under SQL Server

Last modified August 29, 2016

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 3682 times

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'

Leave a Comment


x

You might be Interested in these Posts

How to Perform Inner Join using LINQ in C# ?

Are you looking for the syntax on how to perform inner join using LINQ in C# ? . Below is a sample c...

How to decode a base64 string in C#?

Here's a sample code snippet demonstrating how you can easily decode a base64 encoded string in C#. ...

How to disable editing of items in a combo box in c#?

When working in Win forms using C# and especially when you use the combo box , you would have notice...