Condividi tramite


Classe User

The User object represents a SQL Server user.

Spazio dei nomi:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Sintassi

'Dichiarazione
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None Or AutomatedPolicyEvaluationMode.Enforce Or AutomatedPolicyEvaluationMode.CheckOnChanges Or AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
<StateChangeEventAttribute("CREATE_USER", "USER", "GROUP USER")> _
<StateChangeEventAttribute("CREATE_USER", "USER", "SQL USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "SQL USER")> _
<StateChangeEventAttribute("CREATE_USER", "USER", "WINDOWS USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "WINDOWS USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "CERTIFICATE USER")> _
<PhysicalFacetAttribute> _
<StateChangeEventAttribute("CREATE_USER", "USER", "CERTIFICATE USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "GROUP USER")> _
<StateChangeEventAttribute("CREATE_USER", "USER", "ASYMMETRIC KEY USER")> _
<StateChangeEventAttribute("ALTER_USER", "USER", "ASYMMETRIC KEY USER")> _
Public NotInheritable Class User _
    Inherits ScriptNameObjectBase _
    Implements IObjectPermission, ICreatable, IDroppable, IAlterable,  _
    IRenamable, IExtendedProperties, IScriptable
'Utilizzo
Dim instance As User
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[StateChangeEventAttribute("CREATE_USER", "USER", "GROUP USER")]
[StateChangeEventAttribute("CREATE_USER", "USER", "SQL USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "SQL USER")]
[StateChangeEventAttribute("CREATE_USER", "USER", "WINDOWS USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "WINDOWS USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "CERTIFICATE USER")]
[PhysicalFacetAttribute]
[StateChangeEventAttribute("CREATE_USER", "USER", "CERTIFICATE USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "GROUP USER")]
[StateChangeEventAttribute("CREATE_USER", "USER", "ASYMMETRIC KEY USER")]
[StateChangeEventAttribute("ALTER_USER", "USER", "ASYMMETRIC KEY USER")]
public sealed class User : ScriptNameObjectBase, IObjectPermission, 
    ICreatable, IDroppable, IAlterable, IRenamable, IExtendedProperties, 
    IScriptable
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::None|AutomatedPolicyEvaluationMode::Enforce|AutomatedPolicyEvaluationMode::CheckOnChanges|AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"GROUP USER")]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"SQL USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"SQL USER")]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"WINDOWS USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"WINDOWS USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"CERTIFICATE USER")]
[PhysicalFacetAttribute]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"CERTIFICATE USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"GROUP USER")]
[StateChangeEventAttribute(L"CREATE_USER", L"USER", L"ASYMMETRIC KEY USER")]
[StateChangeEventAttribute(L"ALTER_USER", L"USER", L"ASYMMETRIC KEY USER")]
public ref class User sealed : public ScriptNameObjectBase, 
    IObjectPermission, ICreatable, IDroppable, IAlterable, IRenamable, 
    IExtendedProperties, IScriptable
[<SealedAttribute>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "GROUP USER")>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "SQL USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "SQL USER")>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "WINDOWS USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "WINDOWS USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "CERTIFICATE USER")>]
[<PhysicalFacetAttribute>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "CERTIFICATE USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "GROUP USER")>]
[<StateChangeEventAttribute("CREATE_USER", "USER", "ASYMMETRIC KEY USER")>]
[<StateChangeEventAttribute("ALTER_USER", "USER", "ASYMMETRIC KEY USER")>]
type User =  
    class
        inherit ScriptNameObjectBase
        interface IObjectPermission
        interface ICreatable
        interface IDroppable
        interface IAlterable
        interface IRenamable
        interface IExtendedProperties
        interface IScriptable
    end
public final class User extends ScriptNameObjectBase implements IObjectPermission, ICreatable, IDroppable, IAlterable, IRenamable, IExtendedProperties, IScriptable

Osservazioni

To get User object properties, users can be a member of the public fixed server role.

To set User object properties, uses must have ALTE ANY USER permission on the database or be a member of the db_owner fixed database role.

To change the default schema, users must have ALTER permission on the specified user or be the owner of the user.

To create or drop a user, users must have ALTER ANY USER permission on the fixed server role or be a member of the db_owner fixed database role.

To grant, deny, or revoke permission on the specified user to other users, users must have CONTROL permission on the specified user.

Thread Safety

Tutti i membri statici pubblici (Shared in Microsoft Visual Basic) di questo tipo sono sicuri per le operazioni a thread multipli. Non è invece garantita la sicurezza dei membri dell'istanza.

Thread Safety

Tutti i membri pubblici static (Shared in Visual Basic) di questo tipo sono thread safe. I membri di istanza non hanno garanzia di essere thread safe.