| title | sp_testlinkedserver (Transact-SQL) | ||
|---|---|---|---|
| description | sp_testlinkedserver tests the connection to a linked server. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| 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]
Tests the connection to a linked server. If the test is unsuccessful, the procedure raises an exception with the reason of the failure.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_testlinkedserver [ @servername ] = servername
[ ; ]
[!INCLUDE extended-stored-procedures]
The name of the linked server. @servername is sysname, with no default.
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
EXECUTE sp_addlinkedserver 'SEATTLESales', N'SQL Server';
GO
EXECUTE sp_testlinkedserver SEATTLESales;
GO