--Change schema for stored procedures
SELECT 'ALTER SCHEMA dbo TRANSFER '+'[' + s.Name + '].' + p.Name
FROM sys.Procedures p INNER JOIN
sys.Schemas s on p.schema_id = s.schema_id WHERE
s.Name <> 'dbo'
--Alter schemas on tables
SELECT 'ALTER SCHEMA dbo TRANSFER
' + TABLE_SCHEMA + '.' + TABLE_NAME FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo'
No comments:
Post a Comment