title: Number of open connections and the meaning of sleeping status of a connection
body: <p>I ran this query in my database :</p>
  
  <pre><code>SELECT  
  DB_NAME(dbid) as DBName,  
  COUNT(dbid) as NumberOfConnections, 
  loginame as LoginName 
  FROM 
      sys.sysprocesses 
  WHERE  dbid &gt; 0 
  GROUP BY  dbid, loginame 
  
  ---------------------------------------------------
  SELECT  COUNT(dbid) as TotalConnections 
  FROM sys.sysprocesses 
  WHERE  
  dbid &gt; 0 
  ---------------------------------------------------
  exec sp_who2 'Active' 
  </code></pre>
  
  <p>I want to know the total number of connections to my database. The sum of first query and amount of second query are equal but the third query returns a different number of rows.</p>
  
  <p>I want to know what the third query returns? I see some of the status' in the result of the third query are <code>sleeping</code>. What does this mean? Is the connection idle, or it is ready in the pool? What does it mean if I have many <code>sleeping</code> connections in my result?</p>
  
  <p>thanks</p>