| title | sp_enum_login_for_proxy (Transact-SQL) | ||
|---|---|---|---|
| description | sp_enum_login_for_proxy lists associations between security principals and proxies. | ||
| author | VanMSFT | ||
| ms.author | vanto | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Lists associations between security principals and proxies.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_enum_login_for_proxy
[ [ @name = ] N'name' ]
[ , [ @proxy_id = ] proxy_id ]
[ , [ @proxy_name = ] N'proxy_name' ]
[ ; ]
The name of a [!INCLUDE ssNoVersion] principal, login, server role, or msdb database role to list proxies for. @name is nvarchar(256), with a default of NULL.
The proxy identification number of the proxy to list information for. @proxy_id is int, with a default of NULL.
Either the @proxy_id or the @proxy_name can be specified.
The name of the proxy to list information for. @proxy_name is sysname, with a default of NULL.
Either the @proxy_id or the @proxy_name can be specified.
0 (success) or 1 (failure).
| Column name | Data type | Description |
|---|---|---|
proxy_id |
int | Proxy identification number. |
proxy_name |
nvarchar(128) | The name of the proxy. |
flags |
int | Type of the security principal.0 = [!INCLUDE ssNoVersion] login1 = Fixed system role2 = Database role in msdb |
name |
nvarchar(128) | Name of the security principal for the association. |
sid |
varbinary(85) | Security identifier (SID) of the security principal for the association. |
principal_id |
int | Principal ID of the security principal for the association. |
When no parameters are provided, sp_enum_login_for_proxy lists information about all logins in the instance for every proxy.
When a @proxy_id or proxy_name is provided, sp_enum_login_for_proxy lists logins that have access to the proxy. When a @name is provided, sp_enum_login_for_proxy lists the proxies that the login has access to.
When both proxy information and a login name are provided, the result set returns a row if the login specified has access to the proxy specified.
This stored procedure is located in msdb.
Execution permissions for this procedure default to members of the sysadmin fixed server role.
The following example lists all permissions established between logins and proxies in the current instance.
USE msdb;
GO
EXECUTE dbo.sp_enum_login_for_proxy;
GOThe following example lists the proxies that the login terrid has access to.
USE msdb;
GO
EXECUTE dbo.sp_enum_login_for_proxy @name = 'terrid';
GO