The sp_reset_connection Procedure

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.

Brian Moran

May 25, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like