title: Swapping ms-sql tables
body: <p>I want to swap to tables in the best possible manner.<br>
  I have an IpToCountry table, and I create a new one on a weekly basis according to an external CSV file which I import.  </p>
  
  <p>The fastest way I've found to make the switch was doing the following:</p>
  
  <pre><code>sp_rename IpToCountry IpToCountryOld
  go
  sp_rename IpToCountryNew IpToCountry
  go
  </code></pre>
  
  <p>The problem with this is that the table might still be accessed in between.<br>
  How do I approach this problem in SQL?<br>
  In considered using sp_getapplock and sp_releaseapplock, but I want to keep the read from the table function as quick as possible.</p>