Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

sp_helplinkedsrvlogin

SQL Server 2000

Provides information about login mappings defined against a specific linked server used for distributed queries and remote stored procedures.

Syntax

sp_helplinkedsrvlogin [ [ @rmtsrvname = ] 'rmtsrvname' ]
    [ , [ @locallogin = ] 'locallogin' ]

Arguments

[@rmtsrvname =] 'rmtsrvname'

Is the name of the linked server that the login mapping applies to. rmtsrvname is sysname, with a default of NULL. If NULL, all login mappings defined against all the linked servers defined in the local computer running Microsoft® SQL Server™ are returned.

[@locallogin =] 'locallogin'

Is the SQL Server login on the local server that has a mapping to the linked server rmtsrvname. locallogin is sysname, with a default of NULL. NULL specifies that all login mappings defined on rmtsrvname are returned. If not NULL, a mapping for locallogin to rmtsrvname must already exist. locallogin can be an SQL Server login or a Microsoft Windows NT® user. The Windows NT user must have been granted access to SQL Server either directly or through its membership in a Windows NT group that has been granted access.

Return Code Values

0 (success) or 1 (failure)

Result Sets
Column name Data type Description
Linked Server sysname Linked server name.
Local Login sysname Local login for which the mapping applies.
Is Self Mapping smallint 0 = Local Login is mapped to Remote Login when connecting to Linked Server.
1 = Local Login is mapped to the same login and password when connecting to Linked Server.
Remote Login sysname Login name on Linked Server that is mapped to Local Login when Is Self Mapping is 0. If Is Self Mapping is 1, Remote Login is NULL.

Remarks

Before deleting login mappings, use sp_helplinkedsrvlogin to determine the linked servers that are involved.

Permissions

Execution permissions default to the public role.

Examples
A. Display all login mappings for all linked servers

This example displays all login mappings for all linked servers defined on the local computer running SQL Server.

EXEC sp_helplinkedsrvlogin
go

Linked Server    Local Login   Is Self Mapping Remote Login 
---------------- ------------- --------------- -------------- 
Accounts         NULL          1               NULL
Sales            NULL          1               NULL
Sales            Mary          0               sa
Marketing        NULL          1               NULL

(4 row(s) affected)
B. Display all login mappings for a linked server

This example displays all locally defined login mappings for the Sales linked server.

EXEC sp_helplinkedsrvlogin 'Sales'
go

Linked Server    Local Login   Is Self Mapping Remote Login 
---------------- ------------- --------------- -------------- 
Sales            NULL          1               NULL
Sales            Mary          0               sa

(2 row(s) affected)
C. Display all login mappings for a local login

This example displays all locally defined login mappings for the login Mary.

EXEC sp_helplinkedsrvlogin NULL, 'Mary'
go

Linked Server    Local Login   Is Self Mapping Remote Login 
---------------- ------------- --------------- -------------- 
Sales            NULL          1               NULL
Sales            Mary          0               sa

(2 row(s) affected)

See Also

Establishing Security for Linked Servers

sp_addlinkedserver

sp_droplinkedsrvlogin

System Stored Procedures

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.