Compartir a través de


EnumUsers Method

Esta característica se quitará en una versión futura de Microsoft SQL Server. Evite utilizar esta característica en nuevos trabajos de desarrollo y tenga previsto modificar las aplicaciones que actualmente la utilizan.

The EnumUsers method returns a QueryResults object that enumerates the users defined in a Microsoft SQL Server database and their role participation.

Sintaxis

object
.EnumUsers( [ UserName ] )as QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • UserName
    Optional. String that specifies a database user or role by name. When specified, directs content and membership of the returned result set.

Prototype (C/C++)

HRESULT EnumUsers(
LPSQLDMOQUERYRESULTS* ppResults,
LPCOLESTR UserName = NULL);

Returns

When UserName is not specified, or specifies a database user by name, the EnumUsers method returns a QueryResults object that contains one result set defined by these columns.

Column Data type Description

DefDBName

nvarchar(13)

Database used by default when a connection is made using the listed login.

GroupName

nvarchar(17)

Database role. One row is returned for each role of which the user is a member.

LoginName

nvarchar(5)

Login name.

SID

varbinary(91)

System-generated login account.

UserID

char(14)

System-generated database user identifier.

UserName

nvarchar(11)

Database username.

When UserName specifies a database role by name, the EnumUsers method returns a QueryResults object that contains one result set defined by these columns.

Column Data type Description

Group_id

smallint

System-generated role identifier.

Group_name

nvarchar(26)

Name of the database role.

Userid

smallint

System-generated database user identifier.

Users_in_group

nvarchar(26)

Database username.

Applies To:

Database Object