Changes the owner of an object in the current database.
This stored procedure only works with the objects available in Microsoft SQL Server 2000. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER SCHEMA or ALTER AUTHORIZATION instead. sp_changeobjectowner changes both the schema and the owner. To preserve compatibility with earlier versions of SQL Server, this stored procedure will only change object owners when both the current owner and the new owner own schemas that have the same name as their database user names.
A new permission requirement has been added to this stored procedure.
sp_changeobjectowner removes all existing permissions from the object. You will have to reapply any permissions that you want to keep after running sp_changeobjectowner. Therefore, we recommend that you script out existing permissions before running sp_changeobjectowner. After ownership of the object has been changed, you can use the script to reapply permissions. You must modify the object owner in the permissions script before running. For more information about database scripting, see Documenting and Scripting Databases.
To change the owner of a securable, use ALTER AUTHORIZATION. To change a schema, use ALTER SCHEMA.
The following example changes the owner of the authors table to Corporate\GeorgeW.
EXEC sp_changeobjectowner 'authors', 'Corporate\GeorgeW'; GO