| title | sp_testlinkedserver (Transact-SQL) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql | ||
| ms.prod_service | database-engine | ||
| ms.component | system-stored-procedures | ||
| ms.reviewer | |||
| ms.suite | sql | ||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | e63ca7d4-47d6-455e-9aac-421f9683dadc | ||
| caps.latest.revision | 18 | ||
| author | edmacauley | ||
| ms.author | edmaca | ||
| manager | craigg |
[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-md]
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 Syntax Conventions
sp_testlinkedserver [ @servername ] = servername
[ @servername = ]servername
Is the name of the linked server. servername is sysname, with no default value.
None
No permissions are checked; however, the caller must have the appropriate login mapping.
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
sp_addlinkedserver (Transact-SQL)
sp_addlinkedsrvlogin (Transact-SQL)