Revision: 50161
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 13, 2011 01:15 by jprochazka
Initial Code
DECLARE @sourceschema VARCHAR(100) DECLARE @destinationschema VARCHAR(100) SET @sourceschema = 'source_schema' SET @destinationschema = 'destination_schema' SELECT 'ALTER SCHEMA ' + @destinationschema + ' TRANSFER [' + b.name + '].[' + a.name + ']' FROM sys.objects a JOIN sys.schemas b ON a.schema_id=b.schema_id WHERE a.type IN ('U','P','FN','V') AND b.name=@sourceschema
Initial URL
Initial Description
Generates a set of queries to run which will change the schema for all items within a specified schema and change them to another.
Initial Title
Microsoft SQL Server: Rename a database schema.
Initial Tags
Initial Language
SQL