change schema of all tables sql server code example
Example 1: change table schema sql server
USE AdventureWorks2012;
GO
ALTER SCHEMA HumanResources TRANSFER Person.Address;
GO
Example 2: sql server change schema of a table
-- change schema from [dbo] to [exe]
IF (NOT EXISTS (SELECT * FROM sys.schemas WHERE name = 'exe'))
BEGIN
EXEC ('CREATE SCHEMA [exe] AUTHORIZATION [dbo]')
END
ALTER SCHEMA exe
TRANSFER dbo.Employees