Tag Archives: Move object in schemas

Move the schema object from one schema to another in SQL Server

Move object in between schema in SQL Server


ALTER SCHEMA new_schema TRANSFER old_schema.object_name; 

Example: Move the scott schema objects into dbo:

ALTER SCHEMA dbo TRANSFER scott.employees;

Transfer all objects present or created in the different schema:

SELECT 'ALTER SCHEMA dbo TRANSFER scott.'+name+';' where sys.objects where schema_name(schema_id) = 'scott';

ALTER SCHEMA dbo TRANSFER scott.employee;
ALTER SCHEMA dba TRANSFER scott.department;