title: IsolationLevel, Lock Modes, deadlocks and sp_getapplock in MS SQL Server
body: <p>I am new to SQL server and the deadlocking like issues. I read articles about it. I want to understand following things:</p>
  
  <ol>
  <li>SQL server uses appropriate <a href="https://technet.microsoft.com/en-us/library/ms175519(v=sql.105).aspx" rel="nofollow noreferrer">Lock Mode</a> depending on the <a href="https://technet.microsoft.com/en-us/library/ms189122(v=sql.105).aspx" rel="nofollow noreferrer">IsolationLevel</a> I set while beginning the transaction. If this understanding is correct, what's the purpose of <a href="https://msdn.microsoft.com/en-us/library/ms189823.aspx" rel="nofollow noreferrer">sp_getapplock</a> ?</li>
  <li>I am running into the SQL deadlock issue. Several instances of my ASP.NET application running on different servers access the same database. If I use the appropriate IsolationLevel on transactions, do I still need to acquire SQL lock using sp_getapplock? </li>
  </ol>
  
  <p>(I know more appropriate solution is to identify problematic transactions and fix them. But still it's more of a theoretical question.)  </p>