Friday, February 24, 2012

2005 Schemas

Does anyone know if you can rename a schema in 2k5?
I checked out sp_rename, but it doesn't appear to be a supported object type
from the documentation. Unless I'm reading it wrong.
Thanks.
"sqlboy2000" <sqlboy2000@.discussions.microsoft.com> wrote in message
news:C14095AC-5051-4256-ADBD-C330B819FAC3@.microsoft.com...
> Does anyone know if you can rename a schema in 2k5?
> I checked out sp_rename, but it doesn't appear to be a supported object
> type
> from the documentation. Unless I'm reading it wrong.
>
You cannot rename a schema.
David
|||Cool, thanks.
"David Browne" wrote:

> "sqlboy2000" <sqlboy2000@.discussions.microsoft.com> wrote in message
> news:C14095AC-5051-4256-ADBD-C330B819FAC3@.microsoft.com...
>
> You cannot rename a schema.
> David
>
>
|||"sqlboy2000" <sqlboy2000@.discussions.microsoft.com> wrote in message
news:C14095AC-5051-4256-ADBD-C330B819FAC3@.microsoft.com...
> Does anyone know if you can rename a schema in 2k5?
> I checked out sp_rename, but it doesn't appear to be a supported object
> type
> from the documentation. Unless I'm reading it wrong.
> Thanks.
>
I think you'll have to create a new schema then move existing objects to it
using ALTER SCHEMA:
ALTER SCHEMA new_schema_name TRANSFER old_schema_name.object_name
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx

No comments:

Post a Comment