Hello,
(SQL 2005)
Given that a stored procedure and T-SQL code in query analyzer are exactly the same, why would the stored procedure run much slower
When I mean much slower I mean 3 sec for the code in query analyzer as opposed to 2:33 sec for the stored procedure.
Exact same code!
Profiler also gives more reads and writes for stored procedure, and a lot of BatchStarted and BatchCompleted directives between the 'start' and 'end' of the stored procedure.
Any help is greatly appreciated.
-Tim
Also posted this question in the T-SQL forum. Will copy any valued input to both posts.

Stored Procedure Performance
ygermain
--
Adam Machanic
Pro SQL Server 2005, available now
http://www..apress.com/book/bookDisplay.html bID=457
--