title: How to test linkedserver's connectivity in TSQL
body: <p>I need to write a procedure to collect data from several remote servers,</p>
  
  <p>I use linkedservers and OPENQUERY to gather data from servers, but sometimes I lose connection  to some servers or I simply can't connect them (e.g. remote server is offline)- and OPENQUERY results in time-outs in these cases.</p>
  
  <p>So I wanted to check linkedservers connectivity first and then if it's successful run the query, if not just move on to next the remote server.</p>
  
  <p>I tried to put OPENQUERY in TRY - CATCH but it still returned me time-out error, sp_testlinkedserver procedure also returned me time-out error.</p>
  
  <p>I'd really appreciate any help.</p>