Return to Snippet

Revision: 50161
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 [' + + '].[' + + ']' FROM sys.objects a JOIN sys.schemas b
ON a.schema_id=b.schema_id WHERE a.type IN ('U','P','FN','V') AND

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