Compartir a través de


User Clase

The User object represents a SQL Server user.

Espacio de nombres:  Microsoft.SqlServer.Management.Smo
Ensamblado:  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Sintaxis

'Declaración
<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
'Uso
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

Notas

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

Todos los miembros estáticos (compartidos en Microsoft Visual Basic) públicos de este tipo son seguros para operaciones multiproceso. No se garantiza que los miembros de instancia sean seguros para subprocesos.

Seguridad para subprocesos

Todos los miembros públicos static (Shared en Visual Basic) de este tipo son seguros para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.