Changes the owner of an object in the current database.
sp_changeobjectowner [@objname =] 'object', [@newowner =] 'owner'
0 (success) or 1 (failure)
The owner of an object (or the members of the group or role owning the object) has special permissions for the object. Object owners can execute any of the Transact-SQL statements related to the object (for example, INSERT, UPDATE, DELETE, SELECT, or EXECUTE) and can also manage the permissions for the object.
Use sp_changeobjectowner to change the owner of an object if the security account that owns the object has to be dropped but the object must be retained.
Use sp_changedbowner to change the owner of a database.
Only members of the db_owner fixed database role, or a member of both the db_ddladmin and db_securityadmin fixed database roles can execute sp_changeobjectowner.
This example changes the owner of the authors table to Corporate\GeorgeW.
EXEC sp_changeobjectowner 'authors', 'Corporate\GeorgeW'
CREATE TABLE | System Stored Procedures |
sp_changedbowner |