SQL Blog of Zach Stagers

www.scratchbox.co.uk

Moving Database Objects between Schemas the quick way

No Comments »

I’ve been doing a bit database re-structuring lately, and I came across a nice and quick way to move database objects between schemas. Instead of dropping and recreating the object in the schema you require it to be in – simply execute the below:

ALTER SCHEMA MySchema TRANSFER dbo.Sproc;

The above example will move the object “dbo.Sproc” into the “MySchema” schema.

Short and sweet.

Leave a Reply