SET TRANSACTION ISOLATION LEVEL works only with transactions?
<p>In the <a href="https://msdn.microsoft.com/en-us/library/ms173763.aspx" rel="nofollow noreferrer">official example here</a> we have the <code>SET TRANSACTION ISOLATION LEVEL</code> being used in conjunction with an explicitly defined transaction.</p>

<p>My question is, if I execute a query from a SqlCommand, like:</p>

<pre><code>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * from MyTable
</code></pre>

<p>would I benefit from the new isolation level I set?</p>

<p>Or do I need to explicitly define a transaction like this?</p>

<pre><code>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
BEGIN TRANSACTION;
    SELECT * from MyTable
COMMIT TRANSACTION;
</code></pre>

<p><strong>UPDATE:</strong>
As per <a href="https://stackoverflow.com/a/39990330/274589">Randy Levy's answer</a>, I will update my query as follows:</p>

<pre><code>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * from MyTable;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
</code></pre>

<p>This is to overcome <a href="https://stackoverflow.com/q/9851415/274589">possible isolation level leaks when using pooling</a>.</p>