Changes the owner of a database (DBO) to a new login.
Database.SetOwner (
[LoginName :=] idLogin,
[[TransferAliases :=] bTransfer,]
[[OverrideIfAlreadyUser :=] bOverride] )
HRESULT pDatabase->SetOwner (
SQLOLE_LPCSTR idLogin,
BOOL bTransfer = FALSE,
BOOL bOverride = FALSE );
Element | Type | Description |
---|
idLogin | Identifier | Login of the new database owner |
bTransfer | Boolean | Determines if existing aliases and permissions are transferred to the new database owner. The default is False. |
bOverride | Boolean | Determines if the database ownership should still be changed if the new login is already a user in this database. If True, the specified login will become the new database owner. If False, the specified login will become the new database owner only if that login is not a user in this database. The default is False. |
This is an indexed property.
sp_changedbowner