I have a stored procedure that I use for a report. The stored procedure takes a single parameter (month, passed in as a DATETIME: i.e.: 5/1/2009).
The logic of the stored procedure is a little complicated, though I've written more complex queries.
When I run the query in Query Analyzer, it returns the resultset fairly quickly. As in, under 1 second.
However, when I run the stored procedure, it just spins, and spins and spins. Same exact logic, same exact single parameter. I've let it go for 15, 20 minutes, and never gotten any results back.
I have tried saving the query with the WITH RECOMPILE clause, to no avail.
Any ideas? I'm baffled...