Hi guys,
Is there a simple way of moving a table to a different schema? I tried to search the site before posting my question. I couldn't find an answer.
Thank you.
How do I move a table to a different schema?
Moderator: NorbertKrupa
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: How do I move a table to a different schema?
Hi,
You can simply ALTER the table and SET a new schema for it...
Example:
You can simply ALTER the table and SET a new schema for it...
Example:
Code: Select all
dbadmin=> SELECT table_schema FROM tables WHERE table_name = 'my_table';
table_schema
--------------
schema1
(1 row)
dbadmin=> ALTER TABLE schema1.my_table SET SCHEMA schema2;
ALTER TABLE
dbadmin=> SELECT table_schema FROM tables WHERE table_name = 'my_table';
table_schema
--------------
schema2
(1 row)
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.