1 Version 4.0 -- 1/15/89 sp_changedbowner
______________________________________________________________________
NAME: sp_changedbowner
FUNCTION:
Changes the owner of a database.
SYNTAX:
sp_changedbowner loginame
EXAMPLES:
sp_changedbowner albert
Makes the user albert the owner of the current database.
sp_changedbowner Version 4.0 -- 1/15/89 2
______________________________________________________________________
PARAMETERS:
loginame - is the login name of the new owner of the current
database. The new owner must not already be known as either
a user or alias (that is, the new owner must not already be
listed in sysusers or sysalternates).
COMMENTS:
o The sp_changedbowner procedure makes loginame the owner of the
current database.
o The new owner must already have a login name on SQL Server, but
must not have a database name or alias name in the database.
If you want to assign Database Ownership to such a user, drop
his or her database name and alias entries before executing
sp_changedbowner.
o After the sp_changedbowner procedure is executed, the new owner
3 Version 4.0 -- 1/15/89 sp_changedbowner
______________________________________________________________________
is known as Database Owner inside the database.
o If you (as System Administrator) want to grant permissions to
this new owner, grant them to Database Owner-the user is no
longer known inside the database under any other name.
MESSAGES:
You are not the System Administrator so you can't change the
owner of the current database.
The owner of the master database cannot be changed by anyone.
The proposed new Database Owner must have a login on SQL Server.
The specified loginame is already a user in the current database.
To make him or her the Database Owner, first drop his or her
user entry from the current database's sysusers table.
The specified loginame is already aliased in the current data-
base. To make him or her the Database Owner, first drop his
or her user alias entry from the current database's sysalter-
nates table.
sp_changedbowner Version 4.0 -- 1/15/89 4
______________________________________________________________________
The Database Owner was successfully changed.
PERMISSIONS:
Execute permission to Database Owner.
TABLES USED:
master.dbo.sysdatabases, master.dbo.syslogins, sysusers, sysal-
ternates
SEE ALSO:
sp_helpdb, sp_addlogin, sp_dropuser, sp_dropalias, CREATE DATA-
BASE