We can rename table by using T-SQL or SQL server management Studio.
Before renaming any object in SQL server we have to check the dependency of that object.
We can check it by using sp_depends Or sys.sql_expression_dependencies this DMV.
After renaming table we have to change the table name in each queries, stored procedure, views, function and all other objects where it was being referenced.
Using SQL Server Management Studio
To rename a table
- In Object Explorer, right-click the table you want to rename and choose Design from the shortcut menu.
- From the View menu, choose Properties.
- In the field for the Name value in the Properties window, type a new name for the table.
- To cancel this action, press the ESC key before leaving this field.
- From the File menu choose Save table name.
or Simply select the object and press F2 key and type the new name.
Using T SQL:
EXEC sp_rename ‘Schema_name.old_Table_name’, ‘new_Table_name ‘;