Share via


Rename Columns (Database Engine)

You can rename a table column in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL.

In This Topic

  • Before you begin:

    Limitations and Restrictions

    Security

  • To rename columns, using:

    SQL Server Management Studio

    Transact-SQL

Before You Begin

Limitations and Restrictions

Renaming a column will not automatically rename references to that column. You must modify any objects that reference the renamed column manually. For example, if you rename a table column and that column is referenced in a trigger, you must modify the trigger to reflect the new column name. Use sys.sql_expression_dependencies to list dependencies on the object before renaming it.

Security

Permissions

Requires ALTER permission on the object.

Arrow icon used with Back to Top link [Top]

Using SQL Server Management Studio

To rename a column using Object Explorer

  1. In Object Explorer, connect to an instance of Database Engine.

  2. In Object Explorer, right-click the table in which you want to rename columns and choose Rename.

  3. Type a new column name.

To rename a column using Table Designer

  1. In Object Explorer, right-click the table to which you want to rename columns and choose Design.

  2. Under Column Name, select the name you want to change and type a new one.

  3. On the File menu, click Save table name.

Note

You can also change the name of a column in the Column Properties tab. Select the column whose name you want to change and type a new value for Name.

Arrow icon used with Back to Top link [Top]

Using Transact-SQL

To rename a column

To rename a column

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, click New Query.

  3. The following example renames the column TerritoryID in the table Sales.SalesTerritory to TerrID. Copy and paste the following example into the query window and click Execute.

    USE AdventureWorks2012;
    GO
    EXEC sp_rename 'Sales.SalesTerritory.TerritoryID', 'TerrID', 'COLUMN';
    GO
    

For more information, see sp_rename (Transact-SQL).