SQL SERVER – Move a Table From One Schema to Another Schema

Just another day, I have received an email from a regular client of Comprehensive Database Performance Health Check. My client wanted to learn the trick to Move a Table From One Schema to Another Schema. Let us learn it today.

SQL SERVER - Move a Table From One Schema to Another Schema MoveTable-800x350

They had recently imported a huge amount of data from another server. Now accidentally they had given the incorrect name of a schema for the table creation. They wanted to move their newly created table from one schema to another schema. This process is very easy to do and let us learn it together.

ALTER SCHEMA NewSchema
TRANSFER OldSchema.TableName;

That’s it. You can now move your table from older schema to newer schema. I hope you find this quick blog post helpful.

Here are my few recent videos and I would like to know what is your feedback about them. You can subscribe to my youtube channel here.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Schema, SQL Scripts, SQL Server
Previous Post
SQL SERVER – List All Dates Between Start and End Date
Next Post
SQL SERVER Management Studio – Grid vs Text Output

Related Posts

3 Comments. Leave new

  • Marcos Yzquierdo
    May 27, 2021 9:11 pm

    Pinal, great post. Quick question, should the process to move a table from one schema to another take a long time? What if the table is being accessed? I suspect you would want to set the database to single user mode and then perform the schema change.

    Reply
  • How can I move all Tables in synapse

    Reply

Leave a ReplyCancel reply

Exit mobile version