---
title: "How do you rename a table in SQL using the ALTER TABLE statement?"  
description: "How do you rename a table in SQL using the ALTER TABLE statement?"  
author: "Utpal Vishwas"  
published: 2023-08-30  
updated: 2023-08-31  
canonical: https://www.mindstick.com/forum/159765/how-do-you-rename-a-table-in-sql-using-the-alter-table-statement  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 2 minutes  

---

# How do you rename a table in SQL using the ALTER TABLE statement?

How do you [rename](https://www.mindstick.com/interview/23303/how-to-rename-extention-of-mdf-file) a [table in SQL](https://www.mindstick.com/forum/205/find-the-all-column-with-schema-for-any-table-in-sql-server) using the [ALTER](https://www.mindstick.com/forum/159630/create-alter-procedure-must-be-the-first-statement-in-a-query-batch) [TABLE statement](https://www.mindstick.com/forum/159777/how-to-add-a-new-column-to-an-existing-sql-table-using-the-alter-table-statement)?

## Replies

### Reply by Aryan Kumar

Sure, I can help you with that.

To rename a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) in [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) using the `ALTER TABLE` statement, you can use the following syntax:

SQL

```plaintext
ALTER TABLE old_table_name RENAME TO new_table_name;
```

The `old_table_name` is the name of the table that you want to rename. The `new_table_name` is the new name for the table.

For example, the following statement will rename the `customers` table to `customers_new`:

SQL

```plaintext
ALTER TABLE customers RENAME TO customers_new;
```

It is important to note that you cannot rename a table that is being used by another object, such as a constraint or a view.

Here are some additional things to keep in mind when renaming a table:

- The `ALTER TABLE` statement is a Transact-SQL statement. Transact-SQL statements are not reversible, so it is important to make sure that you are renaming the correct table.
- You cannot rename a table that is being used by another object, such as a constraint or a view.
- If you are renaming a table that contains data, you need to make sure that you have a backup of the data before you rename the table.


---

Original Source: https://www.mindstick.com/forum/159765/how-do-you-rename-a-table-in-sql-using-the-alter-table-statement

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
