title: Query Involving Linked Server Raises Distributed Transaction Error When No Transaction is Used or Needed
body: <p>I have a multi-threaded scheduler process (.NET) that calls a stored procedure that needs to pull data from a Linked Server and eventual insert data into a local table.  I'm not explicitly using any transactions--I'm not concerned with the process failing, as I can just rerun.  Furthermore, I want to avoid the complication of distributed transactions (MSDTC).</p>
  
  <p>What I'm running into is that most of the time through the .NET process, I am getting the following error:</p>
  
  <pre><code>The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "XXXX" was unable to begin a distributed transaction.
  OLE DB provider "SQLNCLI11" for linked server "XXXX" returned message "No transaction is active.
  </code></pre>
  
  <p>When I execute the stored procedure from SQL Server Management Studio, it does not get the error.  I've been trying to track down how the SSMS execution differs from .NET, and I've found some instances were the .NET process does NOT get the error.  But even with that, I can't make a distinction between when it fails vs. when it doesn't.</p>
  
  <p>For what it's worth, I put some logging in the procedure to record <code>@@trancount</code>, which is always registering as 2.  I can understand one implicit transaction to cover the <code>INSERT</code> statement to save the log, but I cannot account for the second.  For what it's worth, my stored procedure actually calls a second procedure which accesses the linked server--not sure if this is relevant.  All that said, <code>@@trancount</code> returns 2 even when successful (and regardless if called from SSMS or .NET).</p>
  
  <p>The DBA has changed the linked server properties to ensure "enable promotion of distributed transactions" is false.  What else should I try?  Thanks!</p>