title: What SQL is required to put SQL Server 2005 in single user mode?
body: <p>I would like to know how (and by extension if it's possible) to put SQL Server 2005 in single user mode using SQL statements?  </p>
  
  <p>I found these instructions on the MSDN, but alas they require SSMS.</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/ms345598(SQL.90,loband).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms345598(SQL.90,loband).aspx</a></p>
  
  <p>*To set a database to single-user mode</p>
  
  <ol>
  <li>In Object Explorer, connect to an instance of the SQL Server 2005 Database Engine, and then expand that instance.</li>
  <li>Right-click the database to change, and then click Properties.</li>
  <li>In the Database Properties dialog box, click the Options page.</li>
  <li>From the Restrict Access option, select Single.</li>
  <li>If other users are connected to the database, an Open Connections message will appear. To change the property and close all other connections, click Yes.*</li>
  </ol>