Monday, February 28, 2011

How to Change Schema for Tables, Views and Stored Procedures

SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + o.Name
FROM sys.Objects o
INNER JOIN sys.Schemas s on o.schema_id = s.schema_id
WHERE s.Name = 'yourschema'    And (o.Type = 'U' Or o.Type = 'P' Or o.Type = 'V')

0 comments:

Post a Comment