EnumUsers Method
后续版本的 Microsoft SQL Server 将删除该功能。请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。
The EnumUsers method returns a QueryResults object that enumerates the users defined in a Microsoft SQL Server database and their role participation.
语法
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. |