Pages

Showing posts with label Rename sql column. Show all posts
Showing posts with label Rename sql column. Show all posts

Wednesday, September 18, 2013

SQL Query to Rename Column of a Table


EXECUTE QUERY TO RENAME THE COLUMN :

 sp_RENAME 'YourTableName.OldColumnName', 'NewColumnName' , 'COLUMN'


 FOR EX:

  sp_RENAME 'Student_details.Division', 'Grade' , 'COLUMN'


This Query, Rename the Column 'Division' to the 'Grade' in the 'Student_details' table.

 Rename Your Column may be Risky..

I got this Caution (below in Red) every time , but i got changes successfully without any data loss.

Caution: Changing any part of an object name could break scripts and stored procedures.




 -----     ---     ----     ---------------------------------------------------------------------------------------------------------
Disclaimer: In case of any loss, would not the responsibility of this blog, Data or Author.