I am having trouble with a stored procedure running very slowly in comparison to the same code running very quickly in a separate query window. The Stored Procedure runs in 2 1/2 minutes, but the direct query runs in 1 second.
Some notes:
- I am using SQL Server 2005.
- The query is NOT using cursors.
- I have double and triple checked that both the Stored Procedure and the query are in fact executing the same code.
- I have explored "parameter sniffing", and related solutions to no avail.
Does anyone here have any idea what could be causing this discrepancy?
Some notes:
- I am using SQL Server 2005.
- The query is NOT using cursors.
- I have double and triple checked that both the Stored Procedure and the query are in fact executing the same code.
- I have explored "parameter sniffing", and related solutions to no avail.
Does anyone here have any idea what could be causing this discrepancy?