title: Cross-server SQL query to read from one table (shared) and write to another (local)
body: <p>I've been having a very difficult time trying to read a table on one server and writing to another existing table on my hard drive (local... created using SQL Server Express).  </p>
  
  <p>Here's my code:</p>
  
  <pre><code>insert into [DPS-ABC1DE2\SQLEXPRESS].my_LOCAL_DATABASE.dbo.SHIPMENTS
  select
      CUST_NUMBER,
      SHIPMENT_ID,
      SHIP_DATE,
      MODE_CODE,
      MILES,
      WEIGHT,
      AMOUNT_PAID
  from SHARED_DATABASE.dbo.SHIPMENTS
  where datepart(year,SHIP_DATE)= 2012 and datepart(month,SHIP_DATE) = 1
  </code></pre>
  
  <p>I get the following error message when I run this:</p>
  
  <blockquote>
    <p>Msg 7202, Level 11, State 2, Line 7<br>
    Could not find server 'DPS-ABC1DE2\SQLEXPRESS' in sys.servers. Verify that the correct
    server name was specified. If necessary, execute the stored procedure
    sp_addlinkedserver to add the server to sys.servers.</p>
  </blockquote>
  
  <p>So I've tried using </p>
  
  <pre><code>EXEC sp_addlinkedserver [DPS-ABC1DE2\SQLEXPRESS]
  </code></pre>
  
  <p>but I get this error:</p>
  
  <blockquote>
    <p>"Msg 15247, Level 16, State 1, Procedure sp_MSaddserver_internal, Line 29<br>
    User does not have permission to perform this action."</p>
  </blockquote>
  
  <p>I'm a rookie SQL programmer, so I've had to research this extensively but with no success. Any help would be appreciated!</p>