Introducing PopSQL + dbt. The first SQL editor with built-in dbt support.Read more →

How to Rename a Table in SQL Server in SQL Server

Renaming a table in SQL Server is performed by using SP_RENAME stored procedure:

--the syntax
exec sp_rename  'old_table_name',  'new_table_name';

--rename users_marketing to users table
exec sp_rename  'users_marketing',  'users';

Ready for a modern SQL editor?