Поделиться через


LinkedServerLogins Collection

В будущей версии Microsoft SQL Server эта возможность будет удалена. Избегайте использования этой возможности в новых разработках и запланируйте изменение существующих приложений, в которых она применяется.

The LinkedServerLogins collection contains LinkedServerLogin objects referencing Microsoft SQL Server linked server logins.

Модель объектов SQL-DMO, показывающая текущий объект

Properties

Замечания

SQL Server implements persistent storage of an OLE DB provider name and data source definition called a linked server. For each linked server, you can establish mappings for SQL Server logins. Each mapping, called a linked server login, determines the authentication data provided when a connection to the OLE DB data source is required.

With the LinkedServerLogins collection, you can:

  • Create a SQL Server login mapping record for a linked server.

  • Remove a login mapping for a linked server disabling authentication for the SQL Server login.

For more information about mapping SQL Server logins for OLE DB data sources by using the LinkedServerLogins, see LinkedServerLogin Object.

To remove a login mapping for a linked server

  • Use the Remove method of the LinkedServerLogins collection, as in:

    oLinkedServer.LinkedServerLogins.Remove("stevenb")
    
    ПримечаниеПримечание

    All login mapping records defined for a linked server must be removed before you can remove the linked server and disable distributed query on the OLE DB data source. Before attempting to remove a linked server using the LinkedServer object, either use the Remove method of the LinkedServerLogins collection or set the DropLogins property of the LinkedServer object to True.

When using the Item or Remove method, the LinkedServerLogins collection supports member identification using either name or ordinal reference syntax. For example:

Set oLinkedServerLogin = oLinkedServer.LinkedServerLogins("stevenb")

Or:

Set oLinkedServerLogin = oLinkedServer.LinkedServerLogins(1)
ПримечаниеПримечание

Creating or removing SQL Server constraints implementing key-based referential integrity using the LinkedServerLogins collection requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role securityadmin or a role with greater privilege.