In sql server 2005, how do I change the "schema" of a table without losing any data?
I have a table that got into the "db_owner" schema, and I need it in the "dbo" schema.
Is there a script or command to run to switch it over?
In SQL Server Management Studio:
- Right click the table and select modify (it's called "Design" now)
- On the properties panel choose the correct owning schema.
ALTER SCHEMA [NewSchema] TRANSFER [OldSchema].[Table1]