Alter schema for multiple tables in SQL Server

Alter schema for multiple tables in SQL Server

----- 1. Create and Alter Schema ------

create schema stage

SELECT 'ALTER SCHEMA stage TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];'
FROM sys.Objects DbObjects
INNER JOIN sys.Schemas SysSchemas 
ON DbObjects.schema_id = SysSchemas.schema_id
WHERE SysSchemas.Name = 'dbo'AND (DbObjects.Type IN ('U', 'P', 'V'))

---- U - Table (user-defined)
---- P - SQL Store procedures
---- V - SQL View
Code to alter schema for multiple tables, the output query should be run to alter schema

Great! Next, complete checkout for full access to Datamug.
Welcome back! You've successfully signed in.
You've successfully subscribed to Datamug.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.