sp_testlinkedserver (Transact-SQL)sp_testlinkedserver (Transact-SQL)

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

测试与链接服务器的连接。Tests the connection to a linked server. 如果测试未成功,该过程将引发包含失败原因的异常。If the test is unsuccessful the procedure raises an exception with the reason of the failure.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

  
sp_testlinkedserver [ @servername ] = servername  

参数Arguments

[ @servername = ]servername链接服务器的名称。[ @servername = ]servername Is the name of the linked server. servername的值为sysname,无默认值。servername is sysname, with no default value.

结果集Result Sets

None

权限Permissions

不检查权限;但是,调用方必须具有相应的登录映射。No permissions are checked; however, the caller must have the appropriate login mapping.

示例Examples

以下示例将创建名为 SEATTLESales 的链接服务器,然后测试连接。The following example creates a linked server named SEATTLESales, and then tests the connection.

USE master;  
GO  
EXEC sp_addlinkedserver   
    'SEATTLESales',  
    N'SQL Server';  
GO  
sp_testlinkedserver SEATTLESales;  
GO  

另请参阅See Also

sp_addlinkedserver (Transact-SQL) sp_addlinkedserver (Transact-SQL)
sp_addlinkedsrvlogin (Transact-sql)sp_addlinkedsrvlogin (Transact-SQL)