title: Drop and recreate table (locking)
body: <p>I need to update a large set of data into a SQL Server table which I use for caching and this happens about every 10 minutes.</p>
  
  <p>I find that rather than using "Insert into ...tableName" that dropping the table and recreating it with "Select * INTO ...tableName" is a lot faster.  </p>
  
  <p>My question is though how do I lock the table i.e. prevent users querying the table whilst it is dropping or selecting into? </p>
  
  <p>If I wrap it in a transaction does this work?</p>
  
  <p><strong>Additional</strong>
  Just clarifying this further as I probably wasnt clear enough to start with.  </p>
  
  <p>I was originally using TRUNCATE and then INSERT INTO but this was taking around 8 - 10 seconds.  Which potentially can hold users up.</p>
  
  <p>So what I wanted to do instead was to drop the table and then recreat the table with SELECT INTO which was very much faster.  However, I guess my question was what happens if someone queries the table after the DROP and before the SELECT INTO?  What happens in this instance?</p>