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> ;

Anil Kumar

Anil Kumar is a passionate web developer, previous business owner, social executive, and a father. He has 10+ years of exposure in diverse technologies at variant roles. Anil is much inspired with Mr. Mahesh of c-sharpCo... Read more

http://CodePattern.net
View All Comments