title: How do I go back to multi_user mode
body: <p>Here is my query:</p>
  
  <pre><code>IF EXISTS(%some query%)
  BEGIN
      BEGIN TRY       
  
          ALTER DATABASE [MyDatabase] SET single_user WITH ROLLBACK IMMEDIATE;
  
          --do something
          --throw some exception
  
      END TRY
      BEGIN CATCH
  
          --here I want to set database back to multi_user
  
          RAISERROR ('DBErrorMessage', @ErrorSeverity, @ErrorState);
      END CATCH
  END
  </code></pre>
  
  <p>What is the best way to set database back to <code>multi_user</code>? I am afraid that the most straightforward way might lead to an </p>
  
  <blockquote>
    <p>Database 'MyDatabase' is already open and can only have one user at a time.</p>
  </blockquote>
  
  <p>exception. </p>
  
  <p>By the most straightforward way I mean this one:  </p>
  
  <pre><code>ALTER DATABASE [MyDatabase] SET MULTI_USER
  </code></pre>