sp_testlinkedserver#
Tests the connection to a data source. If the test is unsuccessful the procedure raises an exception with the reason of the failure.
Syntax#
sp_testlinkedserver [ @servername ] = servername
Arguments#
[ @servername = ] servername
Is the name of the connection. servername is sysname, with no default value.
Example#
The following example creates a connection named “myConnection”, tests the connection, and then drops it.
exec sp_addlinkedserver 'myConnection', 'MySql';
exec sp_testlinkedserver 'myConnection';
exec sp_dropserver 'myConnection';
Result:
` text
Msg 40000, Level 16, State 0, Line 0
Unable to connect to any of the specified MySQL hosts.
`