Transferring Tables from Different Schemas
Last modified: September 5, 2023
The topic contains information on how to transfer a table from one schema to another.
To transfer a required object, follow the steps below:
-
On the Fusion menu, click SQL Server, and then select New Schema Comparison. The Schema Comparison wizard opens.
-
On the Source and Target tab, specify the schema where you want to insert the table in.
-
Switch to the Mapping tab, and specify the schema you want to move.
-
Check Compare only mapped schemas.
-
Click the Compare button.
-
Having compared two schemas, click Synchronize, or press F8. The synchronization wizard opens.
-
Check the Use ALTER SCHEMA TRANSFER expression option on the Options tab of the synchronization wizard.
-
Click Synchronize.
-
The script example modifies the schema sc1 by transferring the table sc1.table1 from schema sc2 into the schema:
create schema sc1;
GO
create schema sc2;
GO
create table sc1.table1 (id int);
GO
- The result script will be displayed as follows:
ALTER SCHEMA sc2 TRANSFER sc1.table1
GO
Note
- You can only transfer tables between schemas from the same database.
- All permissions associated with the table that is being transferred are dropped when it is moved.
- Only beginning with SQL Server 2005, the Transfer option is available.