How to change the schema of a table in MS-SQL


Suppose current schema name is : schema_A and under this schema I have a table name: myTableName. myTableName table is loaded with some records and I want to just change the schema of this table. 

The command to do so (changing from schema_A to schema_B of a table: 'myTableName' )-

ALTER SCHEMA schema_B TRANSFER schema_A.myTableName ;

i.e. 

ALTER SCHEMA <new_Schema_Name> TRANSFER <current_Schema_Name>.<tableName> ;

Ebook Download
View all
Learn
View all