dbo stands for DataBase Owner. It is a special database user that maps to the owner of the
database. When created, a database is assigned an owner, which is the login that created it.
You can query the database owner using one of the following queries:
This login is automatically mapped to the dbo special user, and thus is granted all
permissions in the database. You can change the owner of a database by using the
following command:
This will change the owner of the marketing database to the sa login.
database. When created, a database is assigned an owner, which is the login that created it.
You can query the database owner using one of the following queries:
SELECT SUSER_SNAME(owner_sid)
,NAME
FROM sys.databases;
-- or :
SELECT SUSER_SNAME(sid)
FROM sys.database_principals
WHERE principal_id = USER_ID('dbo');
This login is automatically mapped to the dbo special user, and thus is granted all
permissions in the database. You can change the owner of a database by using the
following command:
ALTER AUTHORIZATION ON DATABASE::marketing TO sa;
This will change the owner of the marketing database to the sa login.
No comments:
Post a Comment