Monday, September 29, 2008

ALTER SCHEMA (Transact-SQL) for SQL Server 2005

If your working with different schemas on SQL Server 2005, you may want to switch the schema of your objects.

ALTER SCHEMA can only be used to move securables between schemas in the same database. To change or drop a securable within a schema, use the ALTER or DROP statement specific to that securable.

Syntax: ALTER SCHEMA schema_name TRANSFER securable_name

Example:
ALTER SCHEMA work TRANSFER dbo.ItemNameValuePair
GO
ALTER SCHEMA person TRANSFER work.ItemNameValuePair
GO

Resources:
MSDN Article

No comments: