Copy a database to a new schema in an existing database Just curious if there is a way to create a new schema that is based on an existing database.
Assuming the existing database has dbo schema only.
I will be taking an entire database and moving it to an existing database as a new schema within that database.
For copy all tables into new schema in current database :

SELECT 'ALTER SCHEMA New Schema TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];' as 'queries'
FROM sys.Objects DbObjects
INNER JOIN sys.Schemas SysSchemas ON DbObjects.schema_id = SysSchemas.schema_id
WHERE SysSchemas.Name = 'Old Schema' -- 'dbo' if that is schema name of tables
AND (DbObjects.Type IN ('U', 'P', 'V'))


Where type 'U' denotes user tables, 'V' denotes views and 'P' denotes stored procedures.

Running the above script will generate the SQL commands needed to transfer objects from one schema to another inside result view table in bottom of page.

Something like this :

ALTER SCHEMA Inf TRANSFER [dbo].[t_Link];
ALTER SCHEMA Inf TRANSFER [dbo].[t_News];


Now click on column header ( queries ) and right click, copy all rows, then paste in query windows and Execute.

Now all of objects are in your new schema.