title: Access another SQL Server through stored procedure
body: <p>I want to access another SQL Server to import and update data of that server's database through a stored procedure.</p>
  
  <p>For that I created linked server using <code>sp_addlinkedserver</code>.</p>
  
  <pre><code>EXEC sp_addlinkedserver 
      @server = N'LINKEDSERVER'
      ,@srvproduct=N''
      ,@provider=N'SQLOLEDB'
      ,@datasrc=N'[DB-Instance.cuprxxxlj.ap-xxxxxxx-x.rds.amazonaws.com]';
  </code></pre>
  
  <p>Then try to access by SQL query</p>
  
  <pre><code>SELECT * 
  FROM [LINKEDSERVER].[DATABASE].[dbo].[TABLE]
  </code></pre>
  
  <p>And getting errors like</p>
  
  <blockquote>
    <p>OLE DB provider "SQLNCLI11" for linked server "LINKEDSERVER" returned message "Login timeout expired".  </p>
    
    <p>OLE DB provider "SQLNCLI11" for linked server "LINKEDSERVER" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".</p>
    
    <p>Msg 53, Level 16, State 1, Line 0<br>
    Named Pipes Provider: Could not open a connection to SQL Server [53].</p>
  </blockquote>
  
  <p>I had created database instance on amazon server and another is also on the amazon server and both are publicly accessible but don't know why I'm getting <code>Server is not found or not accessible</code>. Am I missing any server site setting or something else?</p>
  
  <p>Please guide me if I am going in wrong direction.</p>