Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to rename the column in SQL in Queries of SQL Queries
4198 Views
Hints 
sp_RENAME uses in Transact-SQL.it used to change the object names like column names, Database name and user defined type.

In the following example i show how to change the column name with syntax and example.To change the column the required parameters are table name,old column name and new column name.
Syntax
sp_RENAME 'tableName.[column name to change] ' , 'new column name' , 'COLUMN';
Example
Rename the city column of the Customers table. The new name is Town.
sp_RENAME 'Customers.[city]' , 'Town', 'COLUMN';
Previous Topics
Previous lessons of current book.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details