Rename an existing column of a SQL Server Table

In some cases we need to rename a database table column. But this syntax a bit different from other RDBMS’s. You can not use ALTER in this regard. Sql server provides us a SP named “sp_rename” by which we can rename a column of a table.

SQL Rename Column Syntax:

EXEC sp_rename
@objname = 'TableName.OldColumnName',
@newname = 'NewColumnName',
@objtype = 'COLUMN'

Note: use COLUMN always for @objtype argument value.

For more details about sp_rename CLICK HERE.

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code