Changes the owner of the current database.
sp_changedbowner [@loginame =] 'login' [,[@map =] remap_alias_flag]
0 (success) or 1 (failure)
After sp_changedbowner is executed, the new owner is known as the dbo user inside the database. The dbo has implied permissions to perform all activities in the database.
The owner of the master, model, or tempdb system databases cannot be changed.
To display a list of the valid login values, execute the sp_helplogins stored procedure.
Executing sp_changedbowner with only the login parameter changes database ownership to login and maps the aliases of users who were previously aliased to dbo to the new database owner.
Only members of the sysadmin fixed server role or the owner of the current database can execute sp_changedbowner.
This example makes the user Albert the owner of the current database and maps existing aliases to the old database owner to Albert.
EXEC sp_changedbowner 'Albert'
CREATE DATABASE | sp_helpdb |
sp_dropalias | sp_helplogins |
sp_dropuser | System Stored Procedures |