Rename table | SQL Tutorial and Query Example

Text copied!

Rename table


  • To rename SQL table, you can use the graphical user interface (GUI) or Transact-SQL (T-SQL).
    Here's an example of how to rename table using T-SQL :

    "sp_rename" store procedure is used to rename existing table to a new name. Here's the syntax :

    Here's a step-by-step guide on how to rename SQL table using GUI :

    1. Expand the database that contains the table you want to rename >> Right-click on the table you want to rename in "Tables folder" >> Select "Rename".

    sp_rename 'old_table_name' ,  'new_table_name' ;
            
    Rename table
    USE [SQL Tutorial];
    GO
    sp_rename 'Product' ,  'productMaster' ;
            
    Rename table Rename table Rename table Rename table Rename table Rename table

    Frequently Asked Questions :

    To rename a table in SQL, use the "ALTER TABLE" statement followed by the "RENAME TO" clause.
    "RENAME" is not a standalone command in SQL, but it's used within specific statements like "ALTER TABLE" for renaming tables.
    The rename function in SQL is a capability within the "ALTER TABLE" statement that allows changing the name of a table.
    You change the name of a table in SQL by using the "ALTER TABLE" statement followed by "RENAME TO" and specifying the new table name.