title: Link Server using mirroring
body: <p>I need to configure a SQL Server 2008R2 link server that goes to one database which is principal and has a mirror failover database. For example I'm in server A that needs to perform a query in server B and in case of failover goes to server C. I create a link server named MyLinkS</p>
  
  <p>I'm trying to configure the link server using this connection string:</p>
  
  <pre><code>Server=B;Failover Partner=C;Initial Catalog=MyDatabase;Integrated Security=True;
  </code></pre>
  
  <p>When I'm in server A I'm doing this query:</p>
  
  <pre><code>Select Name from [MyLinkS].[MyDatabase].[dbo].[MyTable] where Name = 'Jhon'
  </code></pre>
  
  <p>When Server B is Principal, the query works, but when I change to be the mirror, it doesn't work, it said that "It is in the middle of a restore".</p>
  
  <p>How can I use the same query as before using one or the other server depending if B is principal or mirror?
  Thank you</p>