The sp_reset_connection Procedure

Q. SQL Server is executing a procedure, sp_reset_connection, that my code doesn't call. What is sp_reset_connection?

A. The sp_reset_connection procedure runs when the OLE DB (or ODBC) connection pool grabs a connection that's been released to the pool but is still active on SQL Server. The SQL Server connection, or server process ID (SPID), might still have connection information from a previous user. Thus, the sp_reset_connection procedure resets the connection so that it's clean for the next user.

For example, temporary tables have scope as long as the SPID that created them is active. When the connection pool reuses that SPID, you don't want the new user to see an old temporary table that should be out of scope. This procedure is lightweight and doesn't cause performance problems. You'll see the procedure whenever a middle-tier box that's using connection pooling accesses SQL Server.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.