title: SQL Server error | Snapshot Isolation related
body: <p>I am getting the following error (using SQL Server 2012). </p>
  
  <blockquote>
    <p>Snapshot isolation transaction failed accessing database 'db1' because snapshot isolation is not allowed in this database. Use ALTER DATABASE to allow snapshot isolation.</p>
  </blockquote>
  
  <p>This situation is different than what other blogs are suggesting. I am querying a database table (db2.table1) from another database (db1) (...using synonyms). The simplified version of the erroring query is the following.</p>
  
  <pre><code>select col1, col2 
  from db1.tab1 t 
  inner join db2.table1
  where xyz = 'abc'
  </code></pre>
  
  <p>db1 has the default isolation level (read-committed) and db2 has the isolation level set to Snapshot isolation.</p>
  
  <p>The query above fails 5 out of 100 cases with the above error message. </p>
  
  <p>This query is being executed using Entity Framework 6 and part of other similar queries in the application. Application is dependent upon db2 for all other operations.</p>
  
  <p>Any suggestions are welcome.</p>
  
  <p>NOTE --> I cannot  set the isolation level of db1 to snapshot isolation as a resolution. </p>