dcsimg
 

Submitted by: Hannes du Preez(ojdupreez1978@gmail.com)

Thursday Dec 13th 2018 by Hannes du Preez

Language: SQL, Expertise: Intermediate - See how to use sp_rename to rename a column in a table.

You can not use the ALTER TABLE statement in SQL Server to rename a column in a table. You can however use the sp_rename stored procedure if you do not want to drop and recreate the table again.

Here is an example of the sp_rename syntax:

sp_rename 'TABLE.OLD_COLUMN_NAME', 'NEW_COLUMN_NAME', 'COLUMN';
Home
Mobile Site | Full Site