sp_rename
can be used to change the name of tables, views, stored procedures, columns (and other objects?) -- -- Create a table -- create table spelled_rwongly (a int); -- -- Manipulate values in table -- insert into spelled_rwongly values (42); -- -- Decide to rename table -- exec sp_rename 'spelled_rwongly', 'spelled_correctly'; -- -- Caution: Changing any part of an object name could break scripts and stored procedures. -- -- -- Use renamed table -- select * from spelled_correctly; drop table spelled_correctly;
create table some_table ( phoo integer, bar varchar(10), bats date ); go exec sp_rename 'some_table.phoo', 'foo'; go exec sp_columns 'some_table' go
sp_rename
does not change the corresponding object name in the sys.sys_modules
catalog view.