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. |