Condividi tramite


Database.SetOwner Method

Definition

Overloads

SetOwner(String)

Sets the owner of this database to the login with the specified name. Does not drop any existing user accounts mapped to the login before attempting to change the owner.

SetOwner(String, Boolean)

Sets the owner of this database to the login with the specified name.

SetOwner(String)

Sets the owner of this database to the login with the specified name. Does not drop any existing user accounts mapped to the login before attempting to change the owner.

public void SetOwner (string loginName);
member this.SetOwner : string -> unit
Public Sub SetOwner (loginName As String)

Parameters

loginName
String

The name of the login to be the new owner

Remarks

If dropExistingUser is not set to true then an existing non-dbo user account mapped to the specified login will cause this to fail.

Applies to

SetOwner(String, Boolean)

Sets the owner of this database to the login with the specified name.

public void SetOwner (string loginName, bool dropExistingUser);
member this.SetOwner : string * bool -> unit
Public Sub SetOwner (loginName As String, dropExistingUser As Boolean)

Parameters

loginName
String

The name of the login to be the new owner

dropExistingUser
Boolean

Whether to drop any existing Users mapped to the specified login for this DB before changing the owner.

Remarks

If dropExistingUser is not set to true then an existing non-dbo user account mapped to the specified login will cause this to fail.

Applies to