Saturday, 15 April 2017

how to rename column name in sql server

Hi friends in this article i will show you how to change/rename column name after creating table in SQL Server.
Actually it is very easy.....lets start


Rename Column Name:- 

Syntax:-  

sp_rename 'TableName.ColumnName','Column';

For suppose I had a table with name kishor in that I had 3 columns. I want to change "kname" as just "name" .


Example:-

sp_rename 'kishor.kname', 'name', 'column';

or

exec sp_rename 'kishor.kname', 'name', 'column';







In the above screenshot you can see the column name changed as "kname" to "name"

I hope you understand.
Thanks for reading. 
I will come with new concept bye.

Ravi Kumar.
Hyderabad India.