Rename Tables and Other Objects

Use sp_rename to rename tables and other database objects: columns, constraints, datatypes, views, indexes, rules, defaults, procedures, and triggers.

You must own an object to rename it. You cannot change the name of system objects or system datatypes. The database owner can change the name of any user’s objects. Also, the object for which you are changing the name must be in the current database.

To rename the database, use sp_renamedb. See the Reference Manual: Procedures.

For example, to change the name of friends_etc to infotable:

sp_rename friends_etc, infotable 

To rename a column, use:

sp_rename "table.column", newcolumnname 

Do not include the table name prefix in the new column name, or the new name is not accepted.

To change the name of an index, use:

sp_rename "table.index", newindexname 

Do not include the table name in the new name.

To change the name of the user datatype tid to t_id, use:

exec sp_rename tid, "t_id"