title: Explicit lock to table(s) in SQL Server?
body: <p>Is it possible to do an explicit shared lock on a  table in SQL Server?</p>
  
  <p>I need to do the following:</p>
  
  <ul>
  <li>shared lock table </li>
  <li>copy table to temp table, for manipulation</li>
  <li>exclusive lock table</li>
  <li>copy stuff from tempTable to table</li>
  <li>release all locks</li>
  </ul>
  
  <p>Basically, I want to be sure that nothing is added to the table, while I'm doing stuff to the temp table, but I still want it to be readable.</p>
  
  <p>For some reason, putting the whole thing in a transaction causes a deadlock in some of the stuff I do to the temp table, so that is not an option.</p>