Created
May 19, 2017 18:26
-
-
Save kristinaconley/3d71189cb59208ad1262ecaec6b9aa98 to your computer and use it in GitHub Desktop.
Alter Schema to Multiple Objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
'ALTER SCHEMA NewSchemaName TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];' | |
FROM sys.Objects DbObjects | |
INNER JOIN sys.Schemas SysSchemas | |
ON DbObjects.schema_id = SysSchemas.schema_id | |
WHERE SysSchemas.Name = 'OldSchemaName' | |
AND (DbObjects.Type IN ('U', 'P', 'V')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment